in reply to Hashing it out: defined? exists?
Two, unless you're storing millions of these, and that's a real bottleneck for you, don't worry about all the extra scalar 1 references. The scalar 1 may already be special-cased to work the same way internally as the singleton scalar undef, but I don't know for sure.
Three, yes, checking for exists is probably more suitable if you are concerned with the presence in the hash than using defined, which discriminates on the type of value associated with a key. After all, you could say $hash{key} = () and the key exists but the value is not defined.
--
[ e d @ h a l l e y . c c ]
|
|---|