# Keep only printable ASCII plus CR, LF, TAB $string =~ tr/\x09\x0A\x0D\x20-\x7E//cd; # Keep only alphanumeric plus space $string =~ tr/A-Za-z0-9 //cd;