in reply to if and else
"( 0 )" is the same as "0", and "0 or EXPR" is the same as just "EXPR".
That means
print "TRUE" if ( 0 ) or die "FALSE";
is equivalent to
print "TRUE" if die "FALSE";
And since die doesn't return, the above is equivalent to just
die "FALSE";
That means
print "TRUE" if ( 0 ) or print "FALSE";
is equivalent to
print "TRUE" if print "FALSE";
which prints FALSE, and if successful, also prints TRUE.
You seem to be under the impression that "print "TRUE" if ( 0 )" is an expression (rather than a statement) or that the operands of "or" can be statements. Neither is the case.
|
|---|