Problems? Is your data what you think it is? | |
PerlMonks |
Re: Re: A better way? Extracting filename from urlby moodster (Hermit) |
on Jan 14, 2002 at 17:01 UTC ( [id://138558]=note: print w/replies, xml ) | Need Help?? |
It works, but I guess you've also got to consider the possibility that the URL will contain query parameters, like this:
http://www.site.com/dir/file.html?param1=val1¶m2=val2
So a second substitution (I'm sure you can do it with a lookahead assertion or similar, but that seems a bit overkill) is probably in order: $file =~ s/\?.*//;
Cheers,
In Section
Seekers of Perl Wisdom
|
|