During debugging the values seem to make sense but I’m not executing the any of the statements. Any ideas? Thanks Elliott$a= 20; $b= 22.5; $c= 23 $atob = $a - $b; $btoc = $b - $c; $atoc = $a - $c; if (((atob > 1 ) || (atob < -1)) && ((atoc > 1) || (atoc < -1)) && ((b +toc > 1) || (btoc < -1))) { print OUTFILE "DIFF > 1 all three\n"; $matrixflags[$row - 4][$i] = 1; $matrixflags[$row - 3][$i] = 1; $matrixflags[$row - 2][$i] = 1; } elsif (((atob > 1) || (atob < -1)) && ((btoc < 1) && (btoc > -1)) && ( +(atoc > 1) || (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 (((atob > 1) || (atob < -1)) && ((btoc > 1) || (btoc < -1)) && ( +(atoc < 1) && (atoc > -1))) { print OUTFILE "DIFFB > 1 $atob $atoc $btoc\n"; $matrixflags[$row - 4][$i] = 0; $matrixflags[$row - 3][$i] = 1; $matrixflags[$row - 2][$i] = 0; } elsif (((atob < 1) && (atob > -1)) && ((btoc > 1) || (btoc < -1)) && ( +(atoc > 1) || (atoc < -1))) { print OUTFILE "DIFFC > 1 $atob $atoc $btoc\n"; $matrixflags[$row - 4][$i] = 0; $matrixflags[$row - 3][$i] = 0; $matrixflags[$row - 2][$i] = 1; } #So in this example in my head the 1st elsif should be executed. #Difference $atob = 1.5 so ((atob > 1) || (atob < -1)) is true. #Difference $btoc = 0.5 so ((btoc < 1) && (btoc > -1)) is true. #Difference $atoc = 3 so ((atoc > 1) || (atoc < -1)) is true.
In reply to if logic OR parentheses problem by Ellhar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |