#!/usr/bin/perl use strict; use Dumpvalue; my $dumper = new Dumpvalue; my $url_string = "http://www.made_up_name.com/image.jpg there might be text between as well since an url like so: http://www.made_up_name.com/image2.gif says to me this might be needed in a larger context so lets try with a string http://www.made_up_name.com/image3_the%20third.png and see what we get."; my @images = map{split/\//;pop @_} $url_string =~ m!(http://\S+/\S+\.[a-z]{3,4})!g; $dumper->dumpValues(\@images); exit; OUTPUTS: 0 ARRAY(0x155ac4c) 0 'image.jpg' 1 'image2.gif' 2 'image3_the%20third.png'