$string =~ tr/\x00-\x09\x0b\x0c\x0e-\x1f//d; #### if ($string =~ m/^([a-zA-Z0-9_])$/) { my $safeString = $1; ### also untainted now }