Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Validation of UserInput is a positive Integer or not?

by ExReg (Priest)
on Dec 07, 2015 at 20:05 UTC ( [id://1149606]=note: print w/replies, xml ) Need Help??


in reply to Validation of UserInput is a positive Integer or not?

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1149606]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found