in reply to perl numeric expressions
If you use eq instead of == it yields the correct result :
#!/usr/bin/perl use strict; use warnings; my $x1 = 44.7; my $x2 = 44.9-0.2; print "numbers $x1 $x2 - "; if ($x1 eq $x2) { print "SAME\n"; } else { print "NOT SAME\n"; }
.. but I'm not sure as why it is so !?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl numeric expressions
by tphyahoo (Vicar) on Nov 28, 2005 at 13:35 UTC | |
by secret (Beadle) on Nov 28, 2005 at 13:40 UTC | |
by tphyahoo (Vicar) on Nov 28, 2005 at 14:39 UTC |