pisium at yahoo.com
Tue Mar 20 17:12:39 CST 2001
Thank you, Rox!
Your explanation is very helpful to me.
However, I double checked 2.
$var = (10, 20, 30);
$var is 30, not 3. I ran it on Unix and NT. It's same.
About your extra examples:
6. $v1, $v2, $v3 = 10, 20, 30;
7. $v1, $v2, $v3 = (10, 20, 30);
I guess it's due to the precedence of '=' ',', '()'
Because () is higher than = than , precedencewise.
Ex 6. It first evaluates $v3 = 10. After that, since
'=' is used already, $v1, $v2 and 10, 20 become
orphans, nowhere to assign the value.
Ex 7. In parens on the right side, it evaluates the
commas within the parens, and 30 is returned, and
assigned $v3 after left side commas evaluation.
Therefore if we print out the results for both like
If that's the case, it explains why in the context of
$var = (10, 20, 30); we get $var = 30.
Weird enough though.
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
Mailing list info: If at any time you wish to (un|re)subscribe to
the list send the request to majordomo at hfb.pm.org. All requests
should be in the body, and look like such
More information about the Anchorage-pm