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


in reply to passing arrays to subroutines

@arr=('1', '2', '3'); test(\@arr); sub test { my $a=@_[0]; print "\n@$a"; }

Replies are listed 'Best First'.
Re^2: passing arrays to subroutines
by nobull (Friar) on Mar 16, 2005 at 21:02 UTC
    my $a=@_[0];

    Unpacking @_ with explicit subscripts is inefficient and unsightly. Using an array slice in a scalar context is also messy.

    my ($a)=@_;
    or
    my $a=shift;