You'll notice that $atob is -2.5, $btoc is -0.5, and $atoc is -3.print join ' ', $atob, $btoc, $atoc, "\n";
For clarity, I'd also use the abs function rather than nested logic:
And like the other monks suggested, use strict; and use warnings; will point out where your code could run into problems. There is also use diagnostics; for an extra helping of advice.if (abs $atob > 1 && abs $btoc > 1 && abs $atoc > 1 ) { print OUTFILE "DIFF > 1 all three\n"; $matrixflags[$row - 4][$i] = 1; $matrixflags[$row - 3][$i] = 1; $matrixflags[$row - 2][$i] = 1; } elsif (abs $atob > 1 && abs $btoc < 1 && abs $atoc > 1 ) { print OUTFILE "DIFFA > 1 $atob $atoc $btoc\n"; $matrixflags[$row - 4][$i] = 1; $matrixflags[$row - 3][$i] = 0; $matrixflags[$row - 2][$i] = 0; } elsif ( ... ) { ... }
In reply to Re: if logic OR parentheses problem
by gamache
in thread if logic OR parentheses problem
by Ellhar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |