The stupid question is the question not asked | |
PerlMonks |
scalar value of list assignmentby tantalor (Initiate) |
on Jan 17, 2012 at 19:05 UTC ( [id://948384]=perlquestion: print w/replies, xml ) | Need Help?? |
tantalor has asked for the wisdom of the Perl Monks concerning the following question: I'm curious about the behavior of the scalar value of a list assignment expression,
This gives me,
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, but the value of the list assignment in list context is the list-context value of list on the left-hand side of the assignment. Is that correct? Is there a simpler way of putting that? This is sort of a surprising result. I expected the list and scalar context values to "match", or come from the same place, but in this case it appears they come from different parts of the expression (left-hand/right-hand sides).
Back to
Seekers of Perl Wisdom
|
|