in reply to undef as a key in a hash.

I think the error message might be better written Can't use '' as a constant name. Or maybe if you try to name a constant 'undef' its key mutates into '', which this code then croaks on.

Or maybe this piece of code never gets hit.

Replies are listed 'Best First'.
Re^2: undef as a key in a hash.
by ikegami (Patriarch) on Sep 25, 2007 at 22:36 UTC
    Nope. '' won't reach there. '' is defined. He'd have to use length instead of defined to check for ''.
      Or use it as a boolean. :-)