Yours is a very special case, because we know there's only one character after the last ".". Here is a benchmark I ran with my new patch:
use Benchmark 'cmpthese';
my $str = join '.', 'a' .. 'z';
cmpthese(-5, {
old => sub { (my $x = $str) =~ s/(.*)\..*/$1/ },
new => sub { (my $x = $str) =~ s/.*\K\..*// },
});
__END__
new: 109650.19/s (n=578953)
old: 45258.35/s (n=241227)
... which is an incredible speed increase!
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;