in reply to Re^2: Search List
in thread Search List

That's wrong. Just looking up a hash key does not autovivfy that key. Consider
my %h = (); print "found" if $h{somekey}; print %h;
which prints nothing. The key "somekey" is not autovivied.


holli, /regexed monk/

Replies are listed 'Best First'.
Re^4: Search List
by patron (Beadle) on Dec 25, 2005 at 14:26 UTC
    Oh my, You're right! I've always thought that exists() is a ugly exception to the rule, that $hash{key} autovivify ``key'' if it doesn't exist. However, using exists() is more explicit and I think I'll still use it in turbo-clean code. Thanks for enlightenment.