I want to set a minimum and maximum number of characters to a field. I can't
seem to get any value to get the maximum to check.
On the perlretut I read
a{n,m} = match at least n times, but not more than m times.
If I type in a year of 12345678 I still seem to find a match:
print "What year? ";
$year=<>;
chomp ($year);
# make sure year is at least 2 but not more # than 4 digits
if ($year =~ /\d{2,4}/) {
print "year is between 2 and 4 digits\n";
} else {
print "Error: year should be between 2 and 4 digits.\n";
}
Anthony English
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]