techsan02 has asked for the wisdom of the Perl Monks concerning the following question:
My trouble is that any part of the version could be updated so I might have to change any combination of major, minor, or revision and the corresponding numbers in the #DBVersion.Update aht set major = 9 #DBVersion=8.3.6 Update aht set minor = 4 #DBVersion=9.3.6 Update aht set revision = 0 #DBVersion=9.4.6
Right now I am thinking I will have to do 9 if's to cover all the possible scenarios. Is there any way to avoid doing this 9 times?if (($UpdatedMajor != "") && ($UpdatedMinor != "") && ($UpdatedRevisio +n != "")){ printf WRITETOFILE 'Update aht set major = '."$UpdatedMajor"."\t\t\ +t".'#DBVersion='."$OldMajor.$OldMinor.$OldRevision\n"; printf WRITETOFILE 'Update aht set minor = '."$UpdatedMinor"."\t\t\ +t".'#DBVersion='."$UpdatedMajor.$OldMinor.$OldRevision\n"; printf WRITETOFILE 'Update aht set revision = '."$UpdatedRevision". +"\t\t\t".'#DBVersion='."$UpdatedMajor.$UpdatedMinor.$OldRevision\n"; + }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to avoid 9 conditionals
by GrandFather (Saint) on Oct 15, 2008 at 21:37 UTC | |
by techsan02 (Initiate) on Oct 17, 2008 at 19:23 UTC | |
by GrandFather (Saint) on Oct 17, 2008 at 21:10 UTC | |
|
Re: Trying to avoid 9 conditionals
by TGI (Parson) on Oct 15, 2008 at 22:38 UTC | |
by GrandFather (Saint) on Oct 15, 2008 at 22:53 UTC | |
by TGI (Parson) on Oct 16, 2008 at 00:51 UTC |