Keep It Simple, Stupid | |
PerlMonks |
Re: A better way? Extracting filename from urlby flocto (Pilgrim) |
on Jan 14, 2002 at 18:28 UTC ( [id://138566]=note: print w/replies, xml ) | Need Help?? |
An easy way to do this is this simple regexp: my ($file) = $url =~ /\/([^\/]*?)(?:\?|$)/ This will work with host:port, directories and parameters given in the url. Hope this works for you.. -octo- -- GED/CC d-- s:- a--- C++(+++) UL+++ P++++$ L++>++++ E--- W+++@ N o? K? w-- O- M-(+) V? !PS !PE !Y PGP+(++) t-- 5 X+ R+(+++) tv+(++) b++@ DI+() D+ G++ e->+++ h!++ r+(++) y+
In Section
Seekers of Perl Wisdom
|
|