![]() |
|
Think about Loose Coupling | |
PerlMonks |
Re: Pre vs Post Incrementing variablesby repellent (Priest) |
on Sep 12, 2010 at 08:55 UTC ( [id://859821]=note: print w/replies, xml ) | Need Help?? |
The docs mention no guarantees for the result of such code. Here's what it seems to be doing (at this time of writing):
(++$i, ++$i) returns two aliases to $i, which has been incremented twice, resulting in (2, 2). ($i++, $i++) returns two copies of $i, one before and one after the first post-increment, resulting in (0, 1).
In Section
Seekers of Perl Wisdom
|
|