Help for this page

Select Code to Download


  1. or download this
    $ 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.
    
  2. or download this
    $ perl -le 'my (@x, @y); @x = ( "A", "B", "C" ); @y = ( "C", "D", "F" 
    +); &test( @x, @y, ); sub test { @test = @_[0]; print "@test\n"; }'
    A
    
  3. or download this
    $ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @
    +y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { @test = @_[0]; pr
    +int "@test\n"; }'
    Variable "@test" is not imported at -e line 1.
    ...
    Global symbol "@test" requires explicit package name (did you forget t
    +o declare "my @test"?) at -e line 1.
    Global symbol "@test" requires explicit package name (did you forget t
    +o declare "my @test"?) at -e line 1.
    Execution of -e aborted due to compilation errors.
    
  4. or download this
    $ 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
    
  5. or download this
    $ 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
    
  6. or download this
    $ perl -Mstrict -Mwarnings -le 'my (@x, @y); @x = ( "A", "B", "C" ); @
    +y = ( "C", "D", "F" ); &test( @x, @y, ); sub test { my @test = @_; pr
    +int "@test\n"; }'
    A B C C D F
    
  7. or download this
    $ 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)
    
  8. or download this
    $ 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