On 16 August 2012 16:28, Lázaro Morales <lazaro@xxxxxxxxxxxxxxxx> wrote: > Hello folks, > > This question is a bit off-topic but the Fedora Community is awesome. This > is the question, How can I from this string: > > my $url = "http://somesite.org/somefile.zip"; # Example URL > > obtain only this sub-string: > > my $file = "somefile.zip"; Why bother wrestiling with complex regular expressions when someone else has already done the work? Perl has a URI module ("yum install perl-URI") which understands how URIs (and URLs) work. I'd recommend using that. use URI; my $url = URI->new('http://somesite.org/somefile.zip'); say $url->path; # prints "/somefile.zip" Then there's the File::Basename module (included with the Perl distribution) for dealing with file paths. use File::Basename; say basename($url->path); # prints somefile.zip Perl programming gets a lot easier if you use the tools that are already there. Cheers. Dave... -- Dave Cross :: dave@xxxxxxxxxxx http://dave.org.uk/ @davorg -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org