in reply to exists on hash autovivifies right?

On a hash-by-hash basis, you can use Hash::Util::lock_keys.

Replies are listed 'Best First'.
Re^2: exists on hash autovivifies right?
by moritz (Cardinal) on Jun 29, 2008 at 21:54 UTC
    That will turn an attempt to autovivify into an exception.
    $ perl -MHash::Util=lock_keys -wle 'my %x; lock_keys %x; exists $x{a}{ +b}' Attempt to access disallowed key 'a' in a restricted hash at -e line 1 +.

    Very useful for debugging.

      that also turns lots of other things into an exception, good luck.
Re^2: exists on hash autovivifies right?
by Anonymous Monk on Jun 30, 2008 at 04:48 UTC
    that's not a solution, unless the lock on keys is what you happen to want. a solution must be precise.