http://www.perlmonks.org?node_id=446062


in reply to Re: The Bad, the Ugly, and the Good of autovivification
in thread The Bad, the Ugly, and the Good of autovivification

Yeah, unfortunally, for algorithms that use 'exists', clamping hashes doesn't make sense. Either the key is known to be there (so, no need for exist), or its existance is volotile, which means that clamping hash prevent the keys from being inserted.

Sure, you can unclamp the hash whenever you insert a new key, but then it might be easier to write your exist test as:

$exists = exists $hash{key1} && exists $hash{key1}{key2};