ok thanks, but how is it that ($a = 2) = 'x' makes $a = 'x' ? | [reply] [d/l] |
| [reply] [d/l] [select] |
print $a = 2, ' ', $a = 3, "\n";
prints
3 3
:)
| [reply] [d/l] [select] |
This is because the entire expression is evaluated before being passed as arguments to print. print doesn't get called iteratively for each argument. It gets its arguments, and then iterates.
So that means $a = 2 is evaluated, then ' ', then $a = 3, and then the values of $a, ' ', and $a are passed to print. By the time the expression has been evaluated, $a contains 3 no matter how many times it appears in @_.
| [reply] [d/l] [select] |