I think what you meant to write was
if ($days =~ /^\s*[1-9][0-9]*\s*$/)The way you wrote it, it would only match a value of $days equal to "1-90-9" plus or minus leading/trailing spaces and the last nine.
Much better is the approach taken by toolic, ww, and Apero.
In reply to Re: Validation of UserInput is a positive Integer or not?
by ExReg
in thread Validation of UserInput is a positive Integer or not?
by G Nagasri Varma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |