$ perl -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( @x, @y, ); sub &test { @test = @_[0]; print "@test\n"; }'
Illegal declaration of anonymous subroutine at -e line 1.
####
$ perl -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { @test = @_[0]; print "@test\n"; }'
A
##
##
$ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { @test = @_[0]; print "@test\n"; }'
Variable "@test" is not imported at -e line 1.
Possible unintended interpolation of @test in string at -e line 1.
Variable "@test" is not imported at -e line 1.
Global symbol "@test" requires explicit package name (did you forget to declare "my @test"?) at -e line 1.
Global symbol "@test" requires explicit package name (did you forget to declare "my @test"?) at -e line 1.
Execution of -e aborted due to compilation errors.
##
##
$ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { my @test = @_[0]; print "@test\n"; }'
Scalar value @_[0] better written as $_[0] at -e line 1.
A
##
##
$ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { my @test = $_[0]; print "@test\n"; }'
A
##
##
$ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { my @test = @_; print "@test\n"; }'
A B C C D F
##
##
$ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( \@x, \@y, ); sub test { my @test = @_; print "@test\n"; }'
ARRAY(0x20071958) ARRAY(0x200718e0)
##
##
$ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" ); &test( \@x, \@y, ); sub test { my @test = @_; foreach my $arr ( @test ) { print "@{$arr}"; } }'
A B C
C D F