in reply to Rexgrep

The 'funny symbols' also tend to be the fastest. It was
the fastest m// routine, but I found it strange that a s///
was still faster.

As mentioned the substr is probably the best anyone can do
for performance, but for readability I would probably go
with the replace routine.
use Benchmark; $img = "http://www.my-website.be/gif/wwwtitle.gif"; timethese(1000000, { 'regexp1' => sub { my($file) = $img =~ m#.*/(.*)# }, 'regexp2' => sub { $img =~ m#[^/]+$#; my $file=$& }, 'regexp3' => sub { $img =~ m#.*/#; my $file=$' }, 'replace' => sub { $file=$img; $file =~ s#^.*/## }, 'split' => sub { my($file) = (split /\//, $img)[-1] }, 'substr' => sub { my $file = substr $img, rindex($img, '/') + 1 +} });
results:
Benchmark: timing 1000000 iterations of regexp1, regexp2, regexp3, rep +lace, split, substr... regexp1: 26 wallclock secs (20.06 usr + 0.06 sys = 20.12 CPU) regexp2: 25 wallclock secs (20.02 usr + 0.06 sys = 20.08 CPU) regexp3: 17 wallclock secs (14.83 usr + 0.04 sys = 14.87 CPU) replace: 17 wallclock secs (13.05 usr + 0.03 sys = 13.08 CPU) split: 30 wallclock secs (24.56 usr + 0.09 sys = 24.65 CPU) substr: 11 wallclock secs ( 8.46 usr + 0.02 sys = 8.48 CPU)