Perl operator for testing if a
hash has a given
key:
exists $a{$key}
evaluates to a
true value
iff the hash
%a has a key
$key.
Note that $a{$key} eq undef and defined $a{$key} (or, worse, just $a{$key}!) don't do the same thing, and are a mistake in this context. undef is a perfectly valid value for a hash element, in addition to being returned when no key exists.
Save yourself future trouble, say what you mean, and the computer will do the right thing!