We have regular expressions, and they have metacharacters and character classes.
if ( $char =~ /\d/ ) { print "It's a digit.\n"; } if ( $char =~ /\w/ ) { print "It's a word-like character.\n"; } if ( $char =~ /[a-zA-Z]/ ) { print "It's an asciibetical alpha character.\n"; } if ( $char =~ /[[:alpha:]]/ ) { print "It's an alpha character.\n"; }
...just to name a few possibilities. See perlre for details.
Dave
In reply to Re: character test functions
by davido
in thread character test functions
by beginer_in_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |