use Benchmark qw(:all); cmpthese ( 5000000, { 'string' => 'string()', 'hash' => 'hash()', 'list2string' => 'list2string()', }); # other subs as before sub list2string { my $str = join( ' ', qw/1689 9679 2792 2514 5472 1520 9342 5544 1268 0165 1979 7314 2101 7221 9539 3882 1812/ ); my $test = 2101; if ($str =~ $test){ # do stuff } } __END__ Rate hash list2string string hash 62406/s -- -88% -95% list2string 530223/s 750% -- -61% string 1355014/s 2071% 156% --