in reply to Question on pattern matching
If you want to kill two birds with one stone, you can verify length and digitness in one statement:if $str =~ /\D/ { print "non-digit" }
if $str !~ /^\d\d$/ { print "wrong length or contains non-digits" }
Cheers - L~R
|
|---|