in reply to passing whole array to a function

Pass a reference to the array, either explicitly,

sub array_fn { my @array = @{+shift}; # ... } array_fn(\@foo);
or else implicitly with a prototype,
sub array_fn (\@) { my $array = shift; # do things to @$array } array_fn(@foo);
The prototype version is generally reserved for subs which will modify their argument array.

After Compline,
Zaxo