http://qs321.pair.com?node_id=138553

Gerard has asked for the wisdom of the Perl Monks concerning the following question:

There must be a better way, but I have always been a clutz when it comes to reg exp and the like so I decided to do this using a split. I get the right results, but it just doesn't seem right...
I have a url with I want to extract the filename off the end. It is easy right? Thought so, I am just having another one of those days when my caffeine levels have snuck dangerously low and my sleep deprevation is finally catching me up, and screaming at me to go to bed... Anyway
$subject="http://www.spied.co.nz/thinmailer.cgi"; @ar = split (/\//, $subject); $filename = @ar[$#ar]; print $filename;
Any suggestions?
Much appreciated, Gerard (the caffeine addict).