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 }, }); #### Rate map_loops for_loops map_loops 499/s -- -40% for_loops 835/s 67% --