in reply to text files are printed after the end of second module

You would do yourself a great favor if you followed the following guidelines:

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:

$url=$_; foreach ($url) { #...
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.

Replies are listed 'Best First'.
Re^2: text files are printed after the end of second module
by Anonymous Monk on Jul 06, 2014 at 23:03 UTC
    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 fanatic.
    You're a nice guy! What the OP posted was a perfect illustration of "write-only Perl". But can Perl itself be blamed for it? I don't think so.
Re^2: text files are printed after the end of second module
by myfrndjk (Sexton) on Jul 07, 2014 at 12:31 UTC

    Hi Thanks for your suggestions and I take all your feed backs and try to improve myself.Thanks for your time