use strict; use warnings; use Benchmark qw(timethis cmpthese); my $str = 'The quick brown fox ' x 100; my $t = timethis (1000, sub {testSub ($str)}); print "\n@$t\n"; sub testSub { my $str = shift; my @matches = $str =~ /(\b.(?!ox))/g; }