Is it undefined, or does do this: $k = $i; $i++; $i = $k;
Both.
$i++ stores the old value, increases the value, and then sets the return value to the stored old value. Although that is true for all versions of Perl, its behaviour is not documented. Actually, it is documented, but wrong:
[...] increment or decrement the variable after returning the value. [...] -- perlopIt doesn't increment after returning. It increments first, and then returns the old value.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
In reply to Re: Re: Re: Incrementing a Hash Value
by Juerd
in thread Incrementing a Hash Value
by arunhorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |