more useful options | |
PerlMonks |
Re: Conditional style (if, &&) queryby chipmunk (Parson) |
on Oct 17, 2001 at 05:57 UTC ( [id://119305]=note: print w/replies, xml ) | Need Help?? |
I've used each of the above, at different times. (Actually, I use expr and b(); rather than &&.) Which one I prefer at any given time depends on the actual expr and b(), the surrounding code, and the intended audience.
expr and b(); is good when the expr is more significant than the call to b(), or when you're emulating a switch statement. b() if expr; is good when the call to b() is more significant than the expr, such as b() if $DEBUG;. if ( expr ) { b(); } is good because it has the clearest structure, especially for people familiar with other languages.
In Section
Seekers of Perl Wisdom
|
|