#!/usr/bin/env perl use strict; use warnings; use Benchmark 'cmpthese'; cmpthese 0 => { with_for => \&with_for, with_map => \&with_map, }; sub with_for { my @f; push @f, [$_+2, $_+1] for 0 .. 5; } sub with_map { my @f = map [$_+2, $_+1], 0 .. 5; }