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)/} @unfiltered; ], 'two' => q[ my @filtered = grep { /exception/ && !/tex/ } @unfiltered; ], 'three' => q[ my @filtered = grep { /exception:/g && !/\Gtex/ } @unfiltered; ], });