my @image_urls; { # Remove one gallery link at a time until we're done. my $gal_url = pop(@found_galleries); my $gal = get($gal_url); # Extract the image URLs from the gallery page. @image_urls = $gal =~ m#(http://{...}.jpg)#g; }