Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: what's this loo code?

by clairudjinn (Beadle)
on Feb 04, 2003 at 20:43 UTC ( #232641=note: print w/ replies, xml ) Need Help??


in reply to what's this loo code?

I wrote to Larry about this sort of thing once:

me: 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. how.

Larry on 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.

Larry on how: It counts them. :-)


Comment on Re: what's this loo code?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-12-28 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls