in reply to Re: wrong output
in thread wrong output

Hi, Actually my concern here is that the total output for QnA mismatches with the result of this code. I have a diffrent code that gives me the total count. I ran both the scripts on 6 logfiles, but for one the total no is 325 and for the above script is only 70, so there is big mismatch. If anyone can suggest anything regarding this by watching my code, then it will be great. Thanks NT

Replies are listed 'Best First'.
Re^3: wrong output
by jethro (Monsignor) on Jul 02, 2009 at 11:38 UTC

    The problem that you don't see anything in temp12 should not have anything to do with the perl program. Maybe you are looking into the wrong temp12 file. Check the directory listing. When you are writing to a file at a specific time the file must have that excact time in the directory listing. If not you are looking at a different file or a file you can't write to.

    About your concern: It was already suggested to you that your script will not find (multi line) log entries that start while a previous (mulit line) log entry isn't finished. Suggested remedies were to only look for the success and failure lines or keep a hash of entries so that you can work on more than one (multi line) log entry at the same time. Did you check if this is the case?

    To find out what is happening in your program, find the first log entry that should have been found but wasn't. Then copy the log file and edit the copy so that that specific log entry is at the start of the log file. If the log entry is found now, you know that previous log entries prevented this from being seen (quite probably the problem I mentioned above). If it still isn't found, use the perl debugger and single step through the code. Or use print statements to find out where the script diverts from your expectation

Re^3: wrong output
by ww (Archbishop) on Jul 02, 2009 at 11:26 UTC
    So what convinces you that the "diffrent code that gives (you) the total count" is correct?

    It's hard to respond to such an assertion without knowing the "diffrent code" (sic).