http://qs321.pair.com?node_id=789342


in reply to if and else

Neither of those snippets is doing what you think it is. Look at what B::Deparse tells you.

% perl -MO=Deparse -e 'print "TRUE" if ( 0 ) or die "FALSE"' print 'TRUE' if die 'FALSE'; % perl -MO=Deparse -e 'print "TRUE" if ( 0 ) or print "FALSE"' print 'TRUE' if print 'FALSE';

Basically, Statement Modifiers are the last thing on a line, so your if ( 0 ) or die "FALSE" actually means if( (0) or die "FALSE"). And the return value of the die (or print) is what determines whether your initial print actually runs. Since print is returning something true, and die doesn't return, you end up with the results you saw.