in reply to Match number >= 0 and <1
And here is a small testmy ($untainted) = ($_num =~ /^(.*)$/); if ($untainted >= 0 and $untainted < 1) { $num = $untainted + 0.0; }
for my $_num (0, 1, ".5", -0.5, 0.5, 9.00000999999, 0.0000099999999, "asdfads", "0.9999999999999999999999999999") { my $num; my ($untainted) = ($_num =~ /^(.*)$/); if ($untainted >= 0 and $untainted < 1) { $num = $untainted + 0.0; } print "$_num $untainted $num\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Match number >= 0 and <1
by ikegami (Patriarch) on Jul 29, 2005 at 14:53 UTC | |
Re^2: Match number >= 0 and <1
by Taulmarill (Deacon) on Jul 29, 2005 at 14:40 UTC | |
by blazar (Canon) on Jul 29, 2005 at 14:52 UTC | |
by ikegami (Patriarch) on Jul 29, 2005 at 14:51 UTC | |
Re^2: Match number >= 0 and <1
by Codon (Friar) on Jul 29, 2005 at 17:01 UTC | |
by gam3 (Curate) on Jul 29, 2005 at 17:55 UTC | |
by Anonymous Monk on Aug 01, 2005 at 14:01 UTC |