We don't bite newbies here... much | |
PerlMonks |
Logic Issues with conditionalsby jmneedhamco (Novice) |
on Mar 27, 2015 at 14:05 UTC ( [id://1121511]=perlquestion: print w/replies, xml ) | Need Help?? |
jmneedhamco has asked for the wisdom of the Perl Monks concerning the following question: Greetings: I am working on a script that updates some files for user access on a propritory system. Basically, I need to update 12 files based on some very weird logic. The English version is as follows: for fileset 1, append file with user string. for fileset 2, append file with user string. these are always done together if developer access. for fileset 3, append file with user string, only if production access. Fileset four is appended with user string, and is different from filesets 1 - 3. if filesets 1 - 3 are appended, push script must be run, if fileset 4 no push. above is highly simplified from the real situation but the 'user strings' mentioned differ. There are four databases that are used, I will call them db1, db2, db3 and db4 for my code. So the jist of what I tried is a nested loop. I am having trouble with the second part of the developer access. Basically, it needs to run an outer loop for all three instances. But if Production is not needed, the loop should terminate. This is done inside another "master loop" that does this foreach user in an input file. I also set a flag variable to try to make this work. Code I tried (not complete script):
The build string sub puts the string to append to the file together (first run through inner loop is db1). Then it calls the writefile sub and appends the string to the file that is passed in from the fileset (@files). Again, this is done for however many users are read in from an input file which is ARGV[0]. Hope someone can help me sort this out. Thanks in advance for the help all!
Back to
Seekers of Perl Wisdom
|
|