in reply to deep usage of if-else!!

In this situation I try if possible to take advantage of early exits:

If this is inside a while or for loop use last as the final statement in any block preceeding an else and omit the else. If it is inside a sub and there are no statements following the topmost if, use return in place of last in a similar fashion.

If need be change the sense of the test to take advantage of this technique. For example, assuming a sub:

$o->check(...); unless ($o->state) { action.. return; } $o->check(...); return if $o->state; action.... $o->blah() return unless $o->state; actions..check.. return if $r->state; and so on... at the same level


DWIM is Perl's answer to Gödel