CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
output of the script is wrong

 



perlisgreat
Novice

Jun 12, 2009, 7:27 AM

Post #1 of 2 (2109 views)
output of the script is wrong Can't Post

Hi,


Code
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


KevinR
Veteran


Jun 12, 2009, 11:29 AM

Post #2 of 2 (2102 views)
Re: [namishtiwari] output of the script is wrong [In reply to] Can't Post

See where my finger is pointing to in your data file? Thats where the problem is. Oh you don't see my finger? Thats OK, because I can't see your data file. That makes use both equally unable to help each other.

Edit...

I am not inclined to help you. You're posting the same question on multiple forums at the same time and I just don't prefer to help people that do that. This is my personal policy and not this forums policy.
-------------------------------------------------


(This post was edited by KevinR on Jun 12, 2009, 11:49 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives