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"; } }