On Mon, 25 Nov 2002 16:17:30 -0800, Yitzchak Scott-Thoennes wrote:
>This isn't an issue of evaluation order. In the example above, perl
>evaluates first $i++, then $i, then $i++, placing the results in a
>list. Then the assignment is done. The reason $y becomes 22 is that
>the *variable* $i is in the list (by reference, if you will), not the
>*value* of $i. Only when the assignment is done is the value
>accessed.
That's right. If you have a bare lvalue as a parameter, an alias to that
original value is used for the result. That means that if the value
changes, the change will be reflected in the parameter list! OTOH, if
you have an expression, then the expression value is used. Compare
($i++, $i, $i++) # alias
with
$i++, "$i", $i++ # expression
That's why I came up with the "+$i" example: is +$i an expression, or
an alias?
--
Bart.