Check for a non-digit:
if ($my_dat =~ /[^0-9]/) { # $my_dat contains a non-digit. ... }
or check for all digits:
if ($my_dat =~ /^[0-9]+$/) { # $my_dat only contains digits. ... }
Update: If you need to make sure the string is only two characters long:
if ($my_dat =~ /^[0-9]{2}$/) { # $my_dat only contains digits. # $my_dat is exactly two characters long. ... }
In reply to Re: Question on pattern matching
by ikegami
in thread Question on pattern matching
by Joe_Cullity
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |