Hi, Here is my code snippet
#!/usr/bin/perl my $logFile = $ARGV[0]; die "usage: $0 <logFile>" unless $logFile; die "Logfile $logFile doesn't exist" unless -f "$logFile"; open($log, "<", $logFile) or die "Can't open $logFile for reading."; print "Processing file $logFile...\n"; my $n = 0; my $ArcotIDError_Count = 0; my $QnAError_Count = 0; my $UPError_Count = 0; my $OTPError_Count = 0; my $errorCode; while( $line = <$log> ) { $n++; $line =~ tr/\r\n//d; if ($line =~ /recvd AA_BIN_MSG_VER_CHG/) { while( $line = <$log> ) { if($line =~ /Handling NSPAdvice for mechanism \[4\]/) { while ( $line = <$log> ) { if ($line =~ /Authentication mechanism returne +d \[(\d+)\]/) { my $errorCode = $1; print "$errorCode\n"; if ($errorCode != 0 && $errorCode != 1) { $ArcotIDError_Count++; } } } } } } } print "Total Number Of ArcotID Authentication ErrorCode returned i +s $ArcotIDError_Count\n";
This code does not give me correct output. Correct output according to my logfile is 142 but it gives me 352. I want to count it in between these lines
starting point- Apricot Native Server: recvd AA_BIN_MSG_VER_CHG and ending point- (Prepared to Send OK) OR (Sending Invalid credential).
I can check the begining statement here but for end statement(so that i always get the out between those lines) what change needed in the code. Thanks NT

In reply to only print data ie between two lines by namishtiwari

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.