my $matchset = "[^$chars]"; # <-- Changed to a negated char class. # .... foreach my $string ( @strings ) { print "$_ is pure" if not $string =~ $reg_match; # Disqualify strings with illegal chars. }