use strict; use Benchmark qw/ cmpthese /; our $a = "abcdefghij" x 1000; cmpthese(-1, { l3epost => q{ my %a; $a{$1}++ while $a =~ /(?=(.{3}))/g }, l3epre => q{ my %a; ++$a{$1} while $a =~ /(?=(.{3}))/g }, l3ipost => q{ my %a; $a{$1}++ while $a =~ /(?=(...))/g }, l3ipre => q{ my %a; ++$a{$1} while $a =~ /(?=(...))/g }, });