Perhaps because "${X()}${X()}" does ${X()} . ${X()} before any stringification makes a copy, so both aliases to the hidden $x are incremented again before their values are copied to the new string. While the other case turns into ( ${X()} . ' ' ) . ${X()} so the first alias to the hidden $x gets copied into a string with a trailing space before $x gets incremented again.
Lots of surprises to discover when you do such things.
- tye
In reply to Re: Order of evaluation/interpolation of references (alias vs copy)
by tye
in thread Order of evaluation/interpolation of references
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |