laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Perhaps an attempt at a possible rewrite of the beginning of your code, just to give an example of modern best practices:
Besides adding use strict; and use warnings;, which in turns forces me to declare all variables (with the my keyword here), the main change is to use an array of arrays to store the data read in your 75 files. You'll end up with something looking like that: I hope this makes the structure clear, don't hesitate to ask if you have any difficulty using such an array of arrays. The basic idea, if you need to read line 2 of the array corresponding to $x is this:
I am not going any further i your code because I don't understand your code, we would really need to see samples of the input data to understand what you do. Please use meaningful variable names, this will make your life much easier. One last comment. This "goto"! Besides the fact that using such goto is usually very much frown upon in general and has been frown upon for about 40 to 45 years (I have never felt I needed to use one in Perl, well, at least not this form of goto which tends to break of the tenets of structured programming), it seems to make little sense to set $choice to 0 and, immediately thereafter, to gototo a place where you test whether $choice is equal to 1. This really looks like a design defect. If you just need to exit all the nested loops, there are better ways to control that, using last or sometimes next, in this case probably with a label. I hope this helps. In reply to Re: Dear Venerable Monks
by Laurent_R
|
|