USING arrayref to pass array to sub - Lists - Perl
Learn
Perl - Lists - Using arrayref to pass array to sub
Using arrayref to pass array to sub
The arrayref for @foo is \@foo. This is handy if you need to pass an array and other things to a subroutine. Passing @foo is like passing multiple scalars. But passing \@foo is a single scalar. Inside the subroutine:
xyz(\@foo,123);...sub xyz{my($arr,$etc)=@_;print$arr->[0];# using the first item in $arr. It is like $foo[0]