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

Your code seems a bit incomplete, since I don't see where prerequest_collect_files_db_url is being called, but I'll assume it's called before you do prerequest2.pl?

The thing that stands out to me is that you close your filehandles outside of the sub, why? I suggest you close your files right after you're done with them. Also, you may want to look into lexical filehandles, which aren't global and get closed when they go out of scope (in case you forget to do it explicitly, which you always should anyways). For example: open my $filehandle, "<", "filename.txt" or die $!; my @input = <$filehandle>; close $filehandle;

Replies are listed 'Best First'.
Re^2: text files are printed after the end of second module
by myfrndjk (Sexton) on Jul 06, 2014 at 17:42 UTC

    thanks for your reply.yes I call "prerequest_collect_files_db_url" first after creating text files in this and I will compare that in prerequest2.pl. When I close there itself i am getting only one line in text files

      Your original post implied that the files were empty when you call prerequest2.pl, but if they have some content then the error situation is actually completely different. Please see "How do I post a question effectively?" and follow the suggestions there (such as providing sample input and expected output) so your posts are more helpful to those providing help.

      How many lines are there in your input? Have you tested your conditions and other parts of the code (xpathconfiguration.pl, domain_check(), and the grep) to be working? I'd suggest printing some debug output in your innermost loops to see what actually gets written to the file. Also, see Basic debugging checklist

        hi sorry for inconvenience the code provided is for prerequest_collect_files_db_url and i expect this module to create 2 text files after creating those files i have to compare to text files in prerequest2.pl.When i run the script text files are created only at the end of prerequest2.pl that is supposed to be created at the end of "prerequest_collect_files_db_url" sub.