in reply to if and else

Try the following, it will give you true for all the evaluations.

print "TRUE" if ( 1 ) or die "FALSE" ; print "TRUE" if ( 2 ) or die "FALSE" ; print "TRUE" if ( 3 ) or print "FALSE" ; print "TRUE" if ( 4 ) or print "FALSE" ;
correlate this with the way Perl responds to return values of (undef, "" or 0) to indicate failure, together with what everybody here said you would notice that, in your code, when the if statement evaluates a 0 or a null return value the "print "TRUE" " statement would not be carried out..but when it evaluates 1 or the execution of another statement that has a return value(as in the second snippet of yours) it will be carried out and you would see "TRUE" printed

Your code addresses a precedence issue as ELISHEVA clarified too (UPDATE)


Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.