#!/usr/bin/perl $break = 0; $newid = "frontis"; while($break == 0) { system "curl -o page.html http://www.teachyourselflatin.com/First_Year_Latin__Collar_Daniell.php?image_id=$newid"; if ($newid eq "311") { $break = 1; } $filename = "page.html"; open FILE, "< $filename" or die "cannot open page"; @contents = ; close FILE; foreach $line (@contents) { if ($line =~ /http/) { $line =~ s/\s+$//; $interestingparts .= $line; } } $oldid = $newid; @stuff = split(/First_Year_Latin__Collar_Daniell.php\?image_id=/,$interestingparts); @imagestuff = split(/view.php\?unique_id=/,$interestingparts); @goodstuff = split(/\"/,$stuff[4]); @goodimagestuff = split(/Collar/,$imagestuff[1]); $newid=$goodstuff[0]; $imageurlthing=$goodimagestuff[0]; $imageurlthing =~ s/&/\\&/; system "curl -o $oldid.jpg http://www.teachyourselflatin.com/view.php?unique_id=${imageurlthing}Collar_Daniell"; print "$newid\n"; #$break = 1; $interestingparts = ""; } end