my @found_images = grep { my $image = get($_); my ($height, $width) = imgsize(\$image); $height <= $max_height and $width <= $max_width } $get_gal =~ m#(http://{...}.jpg)#g;