use strict; use warnings; use Benchmark; my @strings = qw(exception:tex exception:mex asdf); Benchmark::cmpthese( -5, { 'one' => sub { my @filtered = grep { /exception:(?!tex)/} @strings; }, 'two' => sub { my @filtered = grep { /exception/ && !/tex/ } @strings; }, }); __END__ Rate one two one 175458/s -- -15% two 207611/s 18% --