Hello everyone,

The following is from page 75 in the Camel:

"List assignment in scalar context returns the number of elements produced by 
the expression on the <i>right</i> side of the assignment:

$x = ( ($a, $b) = (7,7,7) ); #set $x to 3, not 2

...."

It goes on to explain how this is useful but from previous reading in the same 
section I don't understand how or why this works.  When I first saw this, I 
worked out the assignment where $a and $b each get a 7 and the third 7 is 
discarded, then $x gets the last value in the list of $a and $b because of the 
comma operator for list literals in a scalar context...or does the presence of 
vars in the list mean that this isn't a list literal, more like an array in 
behavior?  So really, I guess I don't understand either side of the assignment 
and how it behaves in scalar context due to $x. :)  So I guess this could end 
up being something I just memorize, but I'd rather understand what's 
happening...

Sorry if this was confusing.

TIA,

Nathanael


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to