exists
exists
exists EXPR
Given an expression that specifies an element of a hash, returns true if the specified element in the hash has ever been initialized, even if the corresponding value is undefined.
print "Exists\n" if exists $hash{$key}; print "Defined\n" if defined $hash{$key}; print "True\n" if $hash{$key};
exists may also be called on array elements, but its behavior is much less obvious and is strongly tied to the use of delete on arrays.
WARNING: Calling exists
on array values is strongly discouraged. The notion of deleting or checking the existence of Perl array elements is not conceptually coherent, and can lead to surprising behavior.
print "Exists\n"