I don't see the point of using a regexp to solve this type of problem. I'd do something like:
if ( eval { use warnings FATAL => 'numeric'; $_num < 1 && $_num >= 0 } + ) { # $_num is OK... $_num =~ /(.*)/; $_num = $1; # untaint $_num # ... }
Update: Thanks to VSarkiss for pointing out the untainting aspect of the problem. I have added untainting code to take care of this. Even with this added requirement I don't see the point of using a regexp to both untaint and check the numeric properties of the variable.
the lowliest monk
In reply to Re: Match number >= 0 and <1
by tlm
in thread Match number >= 0 and <1
by lupey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |