One question - what are you going to use the string for?
If it's going to used in XML / HTML, you should also check there are no ASCII control codes other than \r \n and \t e.g.
if ( $str =~ /[^\x09\x0A\x0D\x20-\x7E]/g ){ print "Contains invalid characters"; }
See HOWTO Avoid Being Called a Bozo When Producing XML.
In reply to Re: testing if a string is ascii
by harryf
in thread testing if a string is ascii
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |