I've found certain triplets of numbers that added up and put in a variable are, equal to 1, print as 1, are true on looks_like_number, match 1 when evaluated with eq but do not match 1 using using ==.
The order the numbers are added matters, the script below produces output in the form.
0.688 + 0.289 + 0.023
total is 1
looks like a number
fails on ==
matches on eq
0.688 + 0.023 + 0.289
total is 1
looks like a number
matches on ==
matches on eq
0.559 + 0.380 + 0.061
total is 1
looks like a number
matches on ==
matches on eq
#!/usr/bin/perl
use strict;
use warnings;
use Scalar::Util qw(looks_like_number);
while (<DATA>) {
if (m{^#}) {
print;
next;
}
chomp;
my ($x, $y, $z) = split(m{ });
# my $var = $x + $y + $z;
my $var = $x;
$var += $y;
$var += $z;
print "$x + $y + $z\n";
print "total is $var\n";
if (looks_like_number($var)) {
print "looks like a number\n";
}
else {
print "doesn't look like a number\n"
}
if ($var == 1) {
print "matches on ==\n";
}
else {
print "fails on ==\n";
}
if ($var eq 1) {
print "matches on eq\n";
}
else {
print "fails on eq\n"
}
print "\n";
}
__DATA__
#FAIL
0.688 0.289 0.023
0.500 0.422 0.078
0.693 0.290 0.017
0.207 0.563 0.230
0.491 0.421 0.088
0.498 0.420 0.082
0.696 0.285 0.019
0.693 0.286 0.021
0.517 0.409 0.074
# ORDER CHANGED
0.688 0.023 0.289
0.422 0.078 0.500
# PASS
0.559 0.380 0.061
0.648 0.314 0.038
0.546 0.414 0.040
0.600 0.348 0.052
0.653 0.311 0.036
0.741 0.245 0.014
0.787 0.201 0.012
0.651 0.318 0.031
0.627 0.331 0.042