in reply to Match number >= 0 and <1

Personally I would:
  1. untaint the number using a suitable regex,
  2. verify that it is actually a number by any method you like most (this could be avoided depending on the regex at the previous point),
  3. verify that it is in the range you're interested in, e.g. $x>=0 and $x<1.
This may seem slitghtly more verbose but should also more clear top read. It all depends on the restictions you want to impose on the input. For example are users allowd to input numbers in scientific notation?

Replies are listed 'Best First'.
Re^2: Match number >= 0 and <1
by jdhedden (Deacon) on Jul 29, 2005 at 16:01 UTC
    For "2." above, I recommend using looks_like_number() from Scalar::Util which is in the standard Perl distribution. (Be sure to upgrade Scalar::Util to latest version from CPAN.)

    Remember: There's always one more bug.