use strict; use Benchmark qw(cmpthese); my @a1 = (1 .. 4_000); cmpthese(4_000, { for_loops => sub { for(@a1) { $_ = $_ + 1 } }, map_loops => sub { map { $_ = $_ + 1 } @a1 }, });