Yes! This appears to be a simple peg count of particular lines. I don't see the need for anything complex. Maybe the Op can tell us if this works? Of course some tweaking of the regex'es...but looks like straight line code to me. I echo previous comments about "use strict; use warnings;".
while( my $line = <$log> )
{
$Success_ArcotID_Count++ if ($line =~ /ArcotID\s*Auth\s*SUCCESS.*/);
$Failure_ArcotID_Count++ if ($line =~ /Auth failed.*/);
$Success_QnA_Count++ if ($line =~ /QNA Auth - Success.*/);
$Failure_QnA_Count++ if ($line =~ /Message: QNA Auth Failed.*/);
$Success_OTP_Count++ if ($line =~ /OTP SUCCESS.*/);
$Failure_OTP_Count++ if ($line =~ /Message: OTP FAILED.*/);
$Success_UP_Count++ if ($line =~ /UPAuth SUCCESS.*/);
$Failure_UP_Count++ if ($line =~ /UPAuth FAILED.*/);
}
If the above does indeed "work" in this application, it can be re-written so that token before either "SUCCESS" or "FAILED" creates a hash table peg count without needing this big "=0" declaration at the front.
I think others have covered the open ">$file" "clobbers previous $file" problem. If you want append, use ">>" for the open.
Glob isn't portable, but that's a different subject. Get the basic stuff working and then we'll talk about that detail.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.