my @x = 1 .. 1_000_000; sub want { return wantarray ? @x : $#x + 1; } sub nowant { return @x; } cmpthese( -10, { '1nowant' => sub { my $x = nowant(); }, '2want' => sub { my $x = want(); }, '3nowant_list' => sub { my $x = () = nowant(); }, '4want_list' => sub { my $x = () = want(); }, }); -------- Benchmark: running 1nowant, 2want, 3nowant_list, 4want_list for at least 10 CPU seconds... 1nowant: 10 wallclock secs (10.25 usr + 0.00 sys = 10.25 CPU) @ 582570.73/s (n=5971350) 2want: 10 wallclock secs (10.05 usr + 0.00 sys = 10.05 CPU) @ 578237.81/s (n=5811290) 3nowant_list: 11 wallclock secs (10.84 usr + 0.00 sys = 10.84 CPU) @ 1.11/s (n=12) 4want_list: 11 wallclock secs (10.66 usr + 0.00 sys = 10.66 CPU) @ 1.13/s (n=12) Rate 3nowant_list 4want_list 2want 1nowant 3nowant_list 1.11/s -- -2% -100% -100% 4want_list 1.13/s 2% -- -100% -100% 2want 578238/s 52234049% 51366692% -- -1% 1nowant 582571/s 52625456% 51751600% 1% --