my @foo = qw(JohnSmith Smiccky aaaaaa); foreach my $f (@foo) { print "Yep $f \n" if ($f =~ /^[qw(Smith Jones)]/); } #### Yep JohnSmith Yep Smiccky