Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; my $macf = 0; my $syman = 0; #intialize all the other variables etc... #start of mainfunction here sub mainfunction(); { if(($macf == 0) && ($syman == 0)) { if(($mac eq $oldMac) && ($sym eq $oldSym)) { print "no changes\n"; } elsif(($mac ne $oldMac) && ($sym ne $oldSym)) { print "section C UPDATE\n"; } elsif($mac ne $oldMac) { print "section B UPDATE\n"; } elsif($sym ne $oldSym) { print "SEction E updated\n"; } } elsif(($macf == 0) && ($syman != 0)) { if($mac ne $oldMac) { print "MacSEction updated\n"; } else { print "no changes to mac\n"; } } elsif(($macf != 0) && ($syman == 0)) { if($sym ne $oldSym) { print "syman update\n"; } else { print "no changes to syman\n"; } } } #end of main function #start of condition checks to call correct function if(($syman == 0) && ($macf == 0)) { myfunc1(); myfunc2(); mainfunction(); } elsif(($syman == 0) && ($macf != 0)) { myfunc1(); mainfunction(); } elsif(($macf == 0) && ($syman != 0)) { myfunc2(); mainfunction(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shorten function conditions
by Roy Johnson (Monsignor) on Feb 02, 2004 at 20:50 UTC | |
by Anonymous Monk on Feb 03, 2004 at 17:51 UTC | |
|
Re: Shorten function conditions
by Fletch (Bishop) on Feb 02, 2004 at 21:27 UTC | |
|
Re: Shorten function conditions
by welchavw (Pilgrim) on Feb 03, 2004 at 03:57 UTC | |
|
Re: Shorten function conditions
by simonm (Vicar) on Feb 03, 2004 at 22:09 UTC |