#!perl-w use Benchmark qw(:all); $toto = 'this+is+my+text'; $count =-5; $results = timethese($count, { 'Translating' => sub { my($copy)=$toto; $copy =~tr/+/ /; }, 'Substituting' => sub { my($copy)=$toto;$copy =~s/\+/ /g; }, }, 'none' ); cmpthese( $results ) ; __END__ Yielded: Rate Substituting Translating Substituting 140156/s -- -68% Translating 436379/s 211% --