#!/usr/bin/perl use strict; use Benchmark qw(cmpthese); sub a { my @list = @{shift()}; $_ +=1 foreach @list; return \@list; }; sub b { my @list = @{shift()}; return [map {$_ += 1} @list]; }; my @foo = 1..10; cmpthese (10, { a => \&a(\@foo), b => \&b(\@foo), });