use strict; use warnings; use Benchmark; my @array; $#array = 1000; sub with_want { return wantarray ? @array : scalar @array; } sub without { return @array; } sub test_with { my @testary = with_want(); my $testscalar = with_want(); } sub test_without { my @testary = with_want(); my $testscalar = with_want(); } my $count = 50000; timethese ( $count, { "With wantarray" => \&test_with, "Without wantarray" => \&test_without } ); __OUTPUT__ Benchmark: timing 50000 iterations of With wantarray, Without wantarray... With wantarray: 16 wallclock secs (17.50 usr + 0.01 sys = 17.52 CPU) @ 2854.70/s (n=50000) Without wantarray: 18 wallclock secs (17.47 usr + 0.01 sys = 17.48 CPU) @ 2859.59/s (n=50000)