The stupid question is the question not asked | |
PerlMonks |
Re: text files are printed after the end of second moduleby Laurent_R (Canon) |
on Jul 06, 2014 at 21:53 UTC ( [id://1092502]=note: print w/replies, xml ) | Need Help?? |
You would do yourself a great favor if you followed the following guidelines:
and not:
Nothing of the above is absolutely necessary, but these things are more important than being necessary, they are essential (i.e. they are part of the essence of good programming). I am sorry to say that, but I frankly don't feel like spending the time to go through such messy code (and I would certainly not hire a programmer who would show me such a sloppy work). You might find my comments so far to be harsh, but they are really meant to help you (and to help us, poor monks, helping you). I am not being extremist or fanatic, quite to the contrary. If I had decided to follow Damian Conway's Perl Best Practices, I would have at least three dozen additional recommendations, so be happy that it is me, and not TheDamian, answering your post. (Just in case, I am just jokingly saying that I might have been much harsher, this is by no means, and should not be understood, construed or interpreted as, a critique on Damian's guidelines.) Having said that, I am not a bad guy, I am actually much nicer than you might think at this point and, despite everything I said so far, I took a bit of time to look a bit through your code, and I have a couple of additional comments. You should probably not use the do function to include external Perl code, this is quasi obsolete. Take a look at the require and use functions and other documentation on Perl modules. This piece of code: does not make much sense to me. The $_ scalar variable contains one single data item (in this case, a text line), and the $url scalar variable also contains one single data item. Why would you want to use foreach to loop on a single data item? As for your precise question, I am sorry, I am unable to answer because your code is incomplete, you haven't shown a sample of the data files you are reading, we don't know what the scripts you are calling with the do function are doing, and your question is far from being clear. But if you do everything that I suggested above, you might actually see what the problem is and find a solution to it. And even if this is not sufficient, well, then post your cleaned-up code, I am sure many more monks (including myself) will feel like wanting to help you further.
In Section
Seekers of Perl Wisdom
|
|