in reply to Re: Re: dumb question
in thread post-increment and post-decrement behavior (was: dumb question)
No, #1 is the correct fix. The postdecrement must return the value from before the decrement operation, which is undef.
In your "fix" #2, how would you handle this situation:
$a = 'a'; print $a--;
By your logic, it would also have to print '0', as Perl would predict it to be a number, and after the decrement $a is -1.
However, I think it is pretty obvious that Perl must print 'a' here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: dumb question
by pg (Canon) on Mar 16, 2003 at 06:13 UTC | |
by jand (Friar) on Mar 16, 2003 at 06:30 UTC |