
perlisgreat
Novice
Jun 12, 2009, 7:27 AM
Post #1 of 2
(1074 views)
|
|
output of the script is wrong
|
Can't Post
|
|
Hi,
my $logFile = $ARGV[0]; die "usage: $0 <logFile>" unless $logFile; die "Logfile $logFile doesn't exist" unless -f "$logFile"; open(my $log, "<", $logFile) or die "Can't open $logFile for reading."; print "Processing file $logFile...\n"; #my $authenticates = {}; my $n = 0; my $ArcotIDError_Count = 0; my $QnAError_Count = 0; my $UPError_Count = 0; my $OTPError_Count = 0; my $errorCode; while(my $line = <$log>) { $n++; $line =~ tr/\r\n//d; if($line =~ /Handling NSPAdvice for mechanism \[4\]/) { while ( $line = <$log> ) { if ($line =~ /Authentication mechanism returned \[(\d+)\]/) { my $errorCode = $1; print "$errorCode\n"; if ($errorCode != 0 && $errorCode != 1) { $ArcotIDError_Count++; } } next; } } } print "Total Number Of ArcotID Authentication ErrorCode returned is $ArcotIDError_Count\n"; When i run the script it gives me the count of 352 but the actual count is 142. I am not able to figure out where the problem is. Kindly help me out in this. Thanks NT
|