Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Don't ask to ask, just ask
 
PerlMonks  

list assignment to list in scalar context

by Anonymous Monk
on Nov 09, 2012 at 02:58 UTC ( #1003051=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    scalar((1,3,5))     #evaluates to the last element of the list --- 5
    if( (5,3,0) )       #evaluates to the last element of the list --- 0, 
    +thus evaluates to FALSE
    $val=(5,6,7);       #evaluates to the last element of the list --- 7
    
  2. or download this
    $ret = (($i, $j, $k)=(5,6,8,9));        #evaluates to the number of el
    +ements on the right side list --- 4
    if( ($k, $v) = ( 1, 0 ) )               #evaluates to the number of el
    +ements on the right side list --- 2, thus evaluates to TRUE
    while ( ($key, $value) = each %map )    #still evaluates to the number
    + of elements on the right side hash
    
  3. or download this
    if( ($k, $v) = ( 1, 0 ) )          
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1003051]
Approved by frozenwithjoy
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-04-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls