http://qs321.pair.com?node_id=439930


in reply to passing arrays to subroutines

A subroutine gets it's arguments as an array (@_), so if you do

my @array = (1,2,3,4,5); some_sub(@array);
Within some_sub, @_ will equal the contents of @array.
However, you probably want to pass the array into the subroutine by reference (see perlref for more):
my @array = (1,2,3,4,5); some_sub( \@array );
In that case, the first element of @_, the argument list to some_sub, will be a reference to @array.


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.