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; } if (grep ($seen{$_}, @SupportedPTs) ) { print "Supported\n"; } else { print "Unsupported\n"; }