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,
-- moodster | [reply] [d/l] [select] |
Moodster has a good point. Thanks all for your comments. To be honest I had not even considered the possiblity of query paramters, which is very silly of me. But hey, it was late. Anway, I can now look at this again a bit later on.
I am constantly amazed and impressed with the good nature and high value of comments that come out of this site.
Regards,
Gerard
The caffeine addict (now sufficiently supplied).
| [reply] |