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 } });