Perl Monk, Perl Meditation | |
PerlMonks |
Re: List context, expression precedence, and ()by pmas (Hermit) |
on Jul 21, 2001 at 22:54 UTC ( [id://98685]=note: print w/replies, xml ) | Need Help?? |
I do like lists, it is so much more flexible for passing parameters, easy to build optional parameters, etc. I just need always be concerned about scalar/list context in expressions, that's all. I found japhy's article about scalar/list context, and it was real eye-opener, when I learned that As japhy explains: The A() function, in scalar context, has the comma operator act on the comma separated series of values, and so $a is set to 'c' which makes sense. $b, however, gets the value 'a', because it invokes list context on the function, which returns a list. japhy: ++ for you! pmas
In Section
Meditations
|
|