use strict; use warnings; use Benchmark; our @strings = qw(exception:tex exception:mex asdf tex:exception:mex); Benchmark::cmpthese( -5, { 'one' => q[ my @filtered = grep { /exception:(?!tex)/} @strings; ], 'two' => q[ my @filtered = grep { /exception/ && !/tex/ } @strings; ], 'three' => q[ my @filtered = grep { /exception:/g && !/\Gtex/ } @strings; ], }); __END__ Rate one two three one 127000/s -- -21% -22% two 161678/s 27% -- -1% three 163855/s 29% 1% --