[EMAIL PROTECTED] wrote:
> Rafael Garcia-Suarez <[EMAIL PROTECTED]> wrote:
> :On 8/18/05, Peter Scott <[EMAIL PROTECTED]> wrote:
> :> This recently bit me:
> :> 
> :> $ perl -wle 'print 42 if defined($h{foo}++)'
> :> 42
> :> 
> :> Now, before thousands of you reach for the flamethrowers, yes, I know
> :> - now - that this is documented.  I found it in perlop right where it
> :> ought to be:
> :> 
> :> | undef is always treated as numeric, and in particular is changed to 0
> :> | before incrementing (so that a post-increment of an undef value will
> :> | return 0 rather than undef).
> :
> :This was documented by Hugo as change 19014 :
> :http://public.activestate.com/cgi-bin/perlbrowse?patch=19014
> :Hugo, any comment on this ?
> 
> I'd much rather the behaviour were as Peter requests, but my synopsis
> in the thread covers my reasoning.

Yes, that makes sense to me as well.
As Jan Dubois put it, "Does the numeric context change the
value that the variable had retroactively?"

Reply via email to