1 |
Hi, |
2 |
|
3 |
I have the following in a perl script: |
4 |
|
5 |
|
6 |
if ($a != $b) { |
7 |
print "e: '$a', t: '$b'\n"; |
8 |
} |
9 |
|
10 |
|
11 |
That will print: |
12 |
|
13 |
e: '69.99', t: '69.99' |
14 |
|
15 |
|
16 |
When I replace != with ne (if ($a ne $a) {), it doesn't print. |
17 |
|
18 |
|
19 |
Is that a bug or a feature? And if it's a feature, what's the explanation? |
20 |
|
21 |
And how do you deal with comparisions of variables when you get randomly |
22 |
either correct results or wrong ones? It's randomly because this |
23 |
statement checks multiple values in the script, and 69.99 is the only |
24 |
number showing up yet which isn't numerically equal to itself (but equal |
25 |
to itself when compared as strings). |