foreach $a(@array) { if ($hash{$a}="correct_value") {print "Success"; last;} else {next;} }