#!/usr/bin/perl use warnings; use strict; use Benchmark qw(cmpthese); cmpthese (-3, {        'regex' => sub { my $str = "a,b,c," x 1000;                        $str =~ s/,//g;                },        'tr' => sub {  my $str = "a,b,c," x 1000;                        $str =~ tr/,//d;                }, }); _ _END_ _         Rate regex    tr regex   878/s    --  -96% tr    19783/s 2154%    --