for my $sPT (@SupportedPTs){ if (! grep{/$sPT/} @ProblemTypes){ print "$sPT is supported\n"; } else { print "$sPT is not supported\n"; } }