Think about Loose Coupling | |
PerlMonks |
Re: Weird syntax questionby Anonymous Monk |
on Aug 23, 2001 at 22:40 UTC ( [id://107453]=note: print w/replies, xml ) | Need Help?? |
What you have in mind is a re-arrangement of:
if ( $x ) { print 1; } else { print 0; } What you are really getting is:
if ( $x or print 0 ) { print 1; } Thus when $x is false, 'print 0' is executed, and then, since the print() returns true, the if-then body is carried out.
In Section
Seekers of Perl Wisdom
|
|