I'd suggest a couple minor changes to update this line in your original version:
with this one:if ( (0 < $days) && ($days <= 90) && ($days =~ /^\d\d$/) )
if ( ($days =~ /^\d+$/) && (0 < $days) && ($days <= 90) )
This avoids printing a warning of Argument "x" isn't numeric in numeric lt (<) by doing the regex test first (consider what the code does with an alpha-string.) Further, the original regex disallows values like "1" which are within the desired spec. No real harm in allowing any number of digits since the later tests verify the range, although using a repeat of {1,2} could also work (I personally try to avoid it as it makes updating the range in the future more complex.)
In reply to Re^2: Validation of UserInput is a positive Integer or not?
by Apero
in thread Validation of UserInput is a positive Integer or not?
by G Nagasri Varma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |