http://www.perlmonks.org?node_id=228829


in reply to Pass local array by reference?

Yes, you can pass another subroutine an array. You're title mentioned something about passing an array by reference. If you pass by reference, include a backslash before the @ symbol. Try this:
sub FOO { my @array; #code here #Here is the pass to BAR &BAR(\@array); } sub BAR { my(@array) = @_; #This will receive the array from FOO #code here }
If you send an array (or any other variable type) by reference, remember to dereference it. You can do this by placing the variable type symbol in front of the $ sign i.e. @$array, $$scalar, %$hash. Once a variable is dereferenced, you can use it like you normally would