use List::MoreUtils qw(any); ... print "Success" if any { $_ eq "correct_value" } @hash{@array};