for my $key ( keys %hash ) { if ( first { $_ eq $key } @array ) { # match logic } else { # no match logic } }