sub write_array_1{ my $file = shift; my $r_array = \@_; open FILE, ">$file" or die "failed to open $file ($!)"; print FILE @$r_array; close FILE; } #### use strict; use warnings; use Benchmark; sub write_array_1{ my $file = shift; my $r_array = \@_; $_++ foreach @$r_array; } sub write_array_2{ my $file = shift; my $r_array = shift; $_++ foreach @$r_array; } sub write_array_31{ my $file = shift; my @array = @_; $_++ foreach @array; } my @array = ( 1..100000 ); my $filename = 'C:\users\jake\testing\arrayref.dat'; timethese(30, { 'Pass by ref transparently' => sub {write_array_1( $filename . 1, @array );}, 'Pass by ref explicitly' => sub {write_array_2( $filename . 2, \@array );}, 'Pass by value' => sub {write_array_3( $filename . 3, @array );}, }); Benchmark: timing 30 iterations of Pass by ref explicitly, Pass by ref transparently, Pass by value... Pass by ref explicitly: 2 wallclock secs ( 1.84 usr + 0.00 sys = 1.84 CPU) @ 16.27/s (n=30) Pass by ref transparently: 3 wallclock secs ( 2.94 usr + 0.00 sys = 2.94 CPU) @ 10.21/s (n=30) Pass by value: 4 wallclock secs ( 4.42 usr + 0.02 sys = 4.44 CPU) @ 6.76/s (n=30)