Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: scalar value of list assignment

by ikegami (Patriarch)
on Jan 18, 2012 at 07:13 UTC ( [id://948491]=note: print w/replies, xml ) Need Help??


in reply to scalar value of list assignment

Mini-Tutorial: Scalar vs List Assignment Operator covers this topic in detail.

So it seems like the value of a list assignment in scalar context is the scalar-context value of the list on the right-hand side of the assignment

No.

>perl -E"say scalar( (4,5,6) )" 6 >perl -E"say scalar( ($x,$y)=(4,5,6) )" 3

List assignment in scalar context evaluates to the number of values to which its RHS evaluates.

the value of the list assignment in list context is the list-context value of list on the left-hand side of the assignment.

Yes.

List assignment in list context evaluates to the values to which its LHS evaluates (as lvalues).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found