in reply to exit EXPR?

Operator precedent is the reason. Try ...

perl -e '$x = 4 ; exit $x > 3 ? 1 : 0' ; echo $? perl -e '$x = 5 ; exit ($x > 3) ? 1 : 0' ; echo $?

Replies are listed 'Best First'.
Re^2: exit EXPR?
by Anonymous Monk on Jul 15, 2014 at 10:04 UTC

    ... or, perhaps parsing ...

    perl -e '$x = 6 ; exit( $x > 3 ? 1 : 0 )' ; echo $?