in reply to bloated 'if' formatting
I like the top down feel this approach gives me.if ( condition1 or condition2 or condition3 ) { # do something } elsif ( condition4 or condition5 ) { # do something else }
As has been mentioned already, if the code does start creeping across more than, say, 3 'levels of indentation' it almost certainly means it'd be better off being rewritten. I can't hold that many levels of a process/sub processes in my head at a time.
I often take a similar approach to functions/objects. An extreme example:
Down is better than across :-)open( my $fh, '<', 'text.txt', ) or die "died";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: bloated 'if' formatting
by Perl Mouse (Chaplain) on Oct 06, 2005 at 09:56 UTC |