http://www.perlmonks.org?node_id=267095

shotgunefx has asked for the wisdom of the Perl Monks concerning the following question:

I've run across something strange. I've got to think it's my sleep deprived stupidity but is seems I have a script where 1+1 isn't computing on both Linux & Windows (5.6.1). It works if I change to eq but isn't it odd that they stringify the same?
Here's the test case.
#!/usr/bin/perl use strict; use warnings; my $base = 0.0425; while ( my $line = <DATA>){ chomp $line; my ($z,$c1,$c2,$c3,$c4) = split(/,/,$line); print join("|",$z,$c1,$c2,$c3,$c4),"\n"; my $total = $c1+$c2+$c3; print $c4 == ($total + $base) ? "True\n" : "False $c4 != ".($total+ +$base)."\n"; } __DATA__ 00501,0.0000,0.0425,0.0025,0.0875 00544,0.0000,0.0425,0.0025,0.0875 06390,0.0000,0.0425,0.0025,0.0875
This outputs

00501|0.0000|0.0425|0.0025|0.0875
False 0.0875 != 0.0875
00544|0.0000|0.0425|0.0025|0.0875
False 0.0875 != 0.0875
06390|0.0000|0.0425|0.0025|0.0875
False 0.0875 != 0.0875


-Lee

"To be civilized is to deny one's nature."