I decided to change my code around a bit, so now I am not seeing a value in my HoH when I print normally, but when I print using Data Dumper I see it??? The item I am NOT seeing is the number 3 under __OUT__. Help! thnkU!
__DUMPER OUT__
$VAR1 = {
DATE: 01/20/2012 TIME: 21:12:38
' => {
ALERT LEVEL: 6 = Boot possible, pending failure - action required
SOURCE: 4 = power
',
SOURCE DETAIL: 4 = high voltage DC power SOURCE ID: FF
PROBLEM DETAIL: 7 = illegal power supply type
',
'19' => ' Days Bet
+ween Today and last Alert'
},
DATE: 02/05/2012 TIME: 07:50:19
' => {
SOURCE DETAIL: 0 = unknown, no source stated SOURCE ID: FF
PROBLEM DETAIL: 0 = no problem detail
',
'3' => ' Days Betw
+een Today and last Alert',
ALERT LEVEL: 2 = Non-Urgent operator attention required
SOURCE: 0 = unknown, no source stated
'
}
};
__OUT__
# perl HPMP_mark3_parselogs.plx
DATE: 01/20/2012 TIME: 21:12:38
==>
ALERT LEVEL: 6 = Boot possible, pending failure - action required
SOURCE: 4 = power
SOURCE DETAIL: 4 = high voltage DC power SOURCE ID: FF
PROBLEM DETAIL: 7 = illegal power supply type
19 Days Between Today and last Alert
DATE: 02/05/2012 TIME: 07:50:19
==>
SOURCE DETAIL: 0 = unknown, no source stated SOURCE ID: FF
PROBLEM DETAIL: 0 = no problem detail
ALERT LEVEL: 2 = Non-Urgent operator attention required
SOURCE: 0 = unknown, no source stated
__ACTUAL_CODE__
use strict;
use warnings;
use FileHandle;
use MIME::Lite;
use Date::Calc "Delta_Days", "Today";
my $RLOG = new FileHandle "+< $Rawlog" or warn "Open failed: $!";
my (@ary, $recordcount, $alert4orMoreCount,
@attnlight, $dateofalert, @dateofalert, $arranged,
$days_between, @days_between, $attnlightcount, @dates,
$alert3orLessCount, %GSPmsgHash, $date, $alertLv, $src, $srcD, $pr
+obD
);
my ( $year,$month,$day ) = Today();
while (<$RLOG>) {
if (/(Log Entry\s\#.*)/) {
++$recordcount;
my $log = $1 .+ "$RTF{ln2}";
my $sys = <$RLOG>;
$date = <$RLOG>;
$alertLv = <$RLOG>;
<$RLOG>;
$src = <$RLOG>;
$srcD = <$RLOG>;
$probD = <$RLOG>;
<$RLOG>;
my $callerA = <$RLOG>;
my $callerAS = <$RLOG>;
my $rptEnt = <$RLOG>;
<$RLOG>;
my $hex1 = <$RLOG>;
my $hex2 = <$RLOG> .+ "$RTF{ln}===========================
+===============";
push @ary, ($log,$sys,$date,$alertLv,$src,$srcD,
$probD,$callerA,$callerAS,$rptEnt,$hex1,$hex2
);
if (/(LEDs:\s+RUN.*)/) {
my $attnlight = <$RLOG>;
push @attnlight, (split(" ", $attnlight, 0))[1];
}
$dateofalert = ((split (" ", $date, 0))[1]);
$dateofalert =~ y /\///d;
$arranged = substr( $dateofalert, -4, 4 ) . substr( $dateof
+alert, 0, 4);
my $yyyy = substr( $arranged, 0, 4);
my $mm = substr( $arranged, -4, 2);
my $dd = substr( $arranged, -2);
$days_between = Delta_Days($yyyy, $mm, $dd, $year, $month, $da
+y);
$GSPmsgHash{$date} = {
$alertLv,
$src,
$srcD,
$probD,
$days_between,
' Days Between Today and last Alert',
}
}
}
$RLOG->close;
while ( my ($k, $v) = each(%GSPmsgHash) ) {
print "\n$k ==>\n",%{$v},"\n";
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.