|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Re^6: Pre vs Post Incrementing variablesby repellent (Priest) |
| on Sep 13, 2010 at 04:20 UTC ( [id://859937]=note: print w/replies, xml ) | Need Help?? |
|
The argument list to print is evaluated from left-to-right. ++${\++$i} is merely incrementing $i twice and returning an alias to $i.
(1) & (4) return aliases to $i. Since $i has been incremented six times, we get 6 for both of them. (2) & (3) return copies to $i because of the zero additions 0+. We get 3 for (2) after three increments, and 4 for (3) with one more increment.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||