my $pics_found = $#found_images + 1; if ($limit_img_size eq "yes") { while ($pics_found < $pics_to_find * 30) # get more than needed so we can randomly choose images later { my $next_gal = pop(@found_galleries); # remove one gallery link at a time until we're done if (!$next_gal) { last; } my $get_gal = get($next_gal); while ($get_gal =~ m#(http://images\.imagefap\.com/images/thumb/\d+/\d+/\d+\.jpg)#g) { print "1 - $1
"; #testing, doesn't print my $image = get($1); print "found $image
"; #testing, doesn't print my ($height, $width) = imgsize(\$image); push @found_images, $image if ($height <= $max_height and $width <= $max_width); } } } else { while ($pics_found < $pics_to_find * 30) { my $next_gal = pop(@found_galleries); if (!$next_gal) { last; } my $get_gal = get($next_gal); ######### # collect our image links ######### push @found_images, $get_gal =~ m#http://images\.imagefap\.com/images/thumb/\d+/\d+/\d+\.jpg#g; $pics_found = $#found_images + 1; } }