Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: array assignment with list operator , no parenthesis

by shmem (Chancellor)
on May 15, 2007 at 10:08 UTC ( [id://615503]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    ($foo) = (7,2,4); # list context - comma := list separator
    print $foo,"\n";
    __END__
    7
    
  2. or download this
    $foo = (7,2,4);   # scalar context despite of parens - comma := 'C' co
    +mma
    print $foo,"\n";
    __END__
    4
    
  3. or download this
    $foo = (7,2,4) x 3; # comma := 'C' comma, 'x' operates on scalar
    print $foo,"\n";
    __END__
    444
    
  4. or download this
    @foo = (7,2,4) x 3; # comma := list separator, 'x' operates on list
    print @foo,"\n";
    __END__
    724724724
    
  5. or download this
    @foo = (7,2,4);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-03-28 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found