$s = 'the quick brown fox jumps over the lazy dog' x 1000;; ++$h{ $_ } for qw[ the quick brown fox jumps over the lazy];; cmpthese -1,{ a => q[ my @words = split ' ', $s;], b => q[ my $n=0; $h{$_} && ++$n for (qw[ the quick brown fox jumps over the lazy dog ]) x 1000; ] };; Rate a b a 95.4/s -- -85% b 644/s 575% --