http://qs321.pair.com?node_id=185239
User since: Jul 25, 2002 at 16:18 UTC (22 years ago)
Last here: May 08, 2003 at 19:38 UTC (21 years ago)
Experience: 186
Level:Beadle (5)
Writeups: 27
Location:Canada
User's localtime: Apr 20, 2024 at 03:09 UTC
Scratchpad: None.
For this user:Search nodes

He just made it so simple...

Here follows the account of clairudjinn, and the finding of the Ring of List Assignment in Scalar Context:

On Wed, 9 Oct 2002, clairudjinn wrote:
"...except maybe Schwartz or folks like that? I'll go there if you won't answer. I'll go insane if you can't. Either way, I can say I emailed the creator of Perl. Weeeeee. About my query... 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 right side of the assignment:

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

...why?"

>>>Because then you can use it for a boolean value:

while (($a,$b) = somefunc()) { ... }

If it used the number of elements on the left, it would always be true.

"...how.?"

>>>It counts them. :-)

Larry