Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: list assignment to list in scalar context

by TGI (Vicar)
on Nov 09, 2012 at 03:33 UTC ( #1003053=note: 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
    my $count_foo = () = /foo/g;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-08-23 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (178 votes), past polls