%hash = ( A => 'that', B => 'those', C => 'groovy', D => 'artichoke', E => undef, F => 'flipping', ); @check = qw( A D F ); # change to 'E' or 'Z' to see if (@check == grep defined, @hash{@check}) { # ok }