... my $count = grep { -1 != index $test, $_ } @wanted; ...