in reply to Shorten function conditions

Nesting conditions will help you avoid retesting the same conditions, though you may have to look harder to see what branch you're following. I think I've kept all the logic from your main section.
if ($macf == 0) { if ($syman == 0) { if($mac eq $oldMac) if ($sym eq $oldSym) { print "no changes\n"; } else { print "SEction E updated\n"; } } elsif ($sym ne $oldSym) { print "section C UPDATE\n"; } else { print "section B UPDATE\n"; } } elsif ($mac ne $oldMac) { print "MacSEction updated\n"; } else { print "no changes to mac\n"; } } elsif ($syman == 0) { if ($sym ne $oldSym) { print "syman update\n"; } else { print "no changes to syman\n"; } }

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: Shorten function conditions
by Anonymous Monk on Feb 03, 2004 at 17:51 UTC
    Roy, Thanks for your time and your script!