$foobar='D'; %hash = ( 'A' => undef, 'B' => undef, 'C' => undef, 'D' => undef ); print "Found a $foobar in \%hash" if exists $hash{$foobar};