in reply to error message in the end of the array looping?

If @array is not too long, then you can use the following:
@matches = grep {$hash{$_} eq "correct_value"} @array; if (@matches){ print "Success" } else { warn "no match" }