In this case...
print defined $h{$elem} ? "Yes" : "No"; print exists $h{$elem} ? "Yes" : "No"; print $h{$elem} ? "Yes" : "No";
Are all equivalent (give the same result). exists returns true if the specified element in the hash has ever been initialized, even if its current value is undefined. In this case, all elements has been initialized to 1. If you undefine one element of the hash, for example undef $h{$elem}, then $h{$elem} still exists, but its value is undef
citromatik
In reply to Re^3: comparing two array
by citromatik
in thread comparing two array
by paola82
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |