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.

Replies are listed 'Best First'.
Re^2: passing arrays to subroutines
by Anonymous Monk on Apr 13, 2011 at 14:22 UTC
    # an array, any array my @bunchOfData = (); # Subroutine: trythis - shows how to pass an array sub trythis { my @array = @_; print "@array\n"; } # where the subroutine is called to do something with the array &trythis(@bunchOfData);