in reply to not getting desired output

Problems:

Fix:

use strict; use warnings; my $ArcotIDError_Count = 0; OUTER: while(my $line = <>) { $line =~ tr/\r\n//d; next if $line !~ /Handling NSPAdvice for mechanism \[4\]/; do { $line = <>; last OUTER if !defined($line); } while $line !~ /Authentication mechanism returned \[(\d+)\]/; my $errorCode = $1; #print("\$errorCode=$errorCode\n"); if ($errorCode != 0 && $errorCode != 1) { $ArcotIDError_Count++; } } print "Total Number Of ArcotID Authentication ErrorCode returned is $A +rcotIDError_Count\n";

( I see that others have identified some of the issues, but not all. )

Update: Reordered points by descending severity.

Replies are listed 'Best First'.
Re^2: not getting desired output
by namishtiwari (Acolyte) on Jun 11, 2009 at 16:06 UTC
    Hi, Sorry, i am getting diffrent output when i run Ikegami script and my script with chnages. I am getting 142 for Ikegami and 352 for my script. Thanks NT

      Like I said, the other monks only found some of the problems in your script. Your script counts errors that aren't for "Handling NSPAdvice for mechanism [4]".

      For example, for the following log, your script counts two errors and mine counts one:

      ...Handling NSPAdvice for mechanism [4]... ...Authentication mechanism returned [3]... ...Handling NSPAdvice for mechanism [5]... ...Authentication mechanism returned [3]...

      This is a symptom of your inner loop not exiting before the end of the log file (the second bullet in the grandparent post).

      Maybe \d+ is too restrictive? If you can have negative numbers, change it to -?\d+
Re^2: not getting desired output
by namishtiwari (Acolyte) on Jun 11, 2009 at 16:04 UTC
    Hi , I got it. You guys are wonderful. Thanks NT