Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: About personal function

by atcroft (Abbot)
on Jul 19, 2018 at 05:20 UTC ( [id://1218802]=note: print w/replies, xml ) Need Help??

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
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1218802]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-20 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found