I do defined $hashtest{abc} and $hashtest{abc} because I want the false condition to be based on more than $hashtest{abc} being undef.
In that case, simply using $hashtest{abc} in boolean context is enough to cover undef as well. (Personally I'd add the defined test if I'm going to be using an operator that will give me a warning when used with an undef value.)
I would not use the mere existence of the key to mean anything
The difference between defined and exists becomes quite significant if one iterates over the hash (keys, values, each).
In reply to Re^2: Are defined or // garantee not to autovivify?
by haukex
in thread Are defined or // garantee not to autovivify?
by NisSam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |