my @SupportedPTs = ('Accounting','Dnd','Essay','FITB','Hotspot','Matching','MC','Narrative','SingleAnswer','SelfGradingGeneric','Sketch','Static','TF'); my @ProblemTypes = ('Accounting','Dnd','test'); my %seen = (); foreach (@ProblemTypes) { $seen{$_} = 1; } for (@SupportedPTs){ if (! $seen{$_}){ print "$_ is supported\n"; } else { print "$_ is not supported\n"; } } #### Accounting is not supported Dnd is not supported Essay is supported FITB is supported Hotspot is supported Matching is supported MC is supported Narrative is supported SingleAnswer is supported SelfGradingGeneric is supported Sketch is supported Static is supported TF is supported #### for my $sPT (@SupportedPTs){ if (! grep{/$sPT/} @ProblemTypes){ print "$sPT is supported\n"; } else { print "$sPT is not supported\n"; } }