Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 scrutinizing the Monastery: (14)
As of 2015-07-07 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls