$ cat t my %h = (a=>1, b=>2, c=>3); print "a ", exists($h{a}) ? "exists" : "does not exist", "\n"; print "c ", exists($h{c}) ? "exists" : "does not exist", "\n"; print "f ", exists($h{f}) ? "exists" : "does not exist", "\n"; $ perl t a exists c exists f does not exist