in reply to
Re: file name parsing to get the original file name
in thread file name parsing to get the original file name
Interesting. It looks like you've found yet another piece of Perl that isn't implemented in the most optimal manner. :-)
Playing around, I found that on my system, the following tweak allows the 'single regexp match' to beat the 'split into a temporary list, and grab the last entry' approach by ~15%:
$f =~ /(?:.*\/)?(.+)/s; my $fn = $1;
I'm still surprised that Perl can match against '/' several times (split) faster than it can skip to the last '/' with a single rather simple match. It seems the Perl regular expression engine could still use a few optimizations. Until then, I suppose explicit optimization isn't that bad.