in reply to Logic Issues with conditionals
Hello jmneedhamco,
So the jist of what I tried is a nested loop.
I suspect that is the wrong approach here. A structure like this:
for(my $i = 0; $i < 3;$i++) { if(...) { ... } elsif($i == 2)
always raises a red flag for me: if you have to treat the case where $i == 2 differently, why try to incorporate it in a loop with the other cases? I think you’d be better off handling the 3 (or should it be 4?) file sets separately.
Also note that this:
for (my $j = 0; $j < 4; $j++) { my $file = $files[$j]; ...
is better expressed in Perl using a foreach loop:
for my $file (@files) { ...
And please note that by calling &WriteFile($file, $acString) with an initial &, you are bypassing its prototype (if any). Unless you have a good reason to do so, it’s better practice to omit the ampersand: WriteFile($file, $acString).
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|