if ($left > 0) { if ($right > 0) { # both pos return 1 } } elsif ($left < 0) { if ($right < 0) { # both neg return 1 } } return 0;