in reply to Match number >= 0 and <1
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Match number >= 0 and <1
by VSarkiss (Monsignor) on Jul 29, 2005 at 18:30 UTC |