#!/usr/bin/perl use strict; use warnings; use 5.010; sub byref { my @a = (1 .. 1000); return \@a; } sub byval { my @a = (1 .. 1000); return @a; } my @somewhere; foreach (1 .. 100000) { # Do something with the data in case they optimize it out #@somewhere = byval(); @somewhere = @{byref()}; }