| Next | Program
Repair Shop ![]() |
43 |
65 if ($What == 1) {
66 print "Creating DIR: ",$InputDIR1.$NextOut,"\n";
67 $I = mkdir ($InputDIR1.$NextOut,0777);
68 } else {
69 print "Creating DIR: ",$InputDIR2.$NextOut,"\n";
70 $I = mkdir ($InputDIR2.$NextOut,0777);
71 }
Why one function? Why not two functions?
Or no functions?
This if-else block is the perfect example of why you should Avoid families of variable names
With an array, it becomes:
print "Creating DIR: ",$InputDIR[$What].$NextOut,"\n";
$I = mkdir ($InputDIR[$What].$NextOut,0777);
Five lines become two
| Next | ![]() |
Copyright © 2002 M. J. Dominus |