Debug time. Need more info.
Is it ever meeting the if's condition's?
Try this and see what happens:
#!/usr/bin/perl -w
use strict;
my $log_file = "/appl/log/00004e4d/20031130.txt";
open LOG, "< $log_file" or die "Could not open file $!";
my ($valueCount, $lineCount);
while ( <LOG> ) {
chomp;
$lineCount++;
if ( /^GTotal Content:/ ) {
my ($gtotal_content, $value) = split(/:/, $_);
printf "Value:%010\n", $value;
$valueCount++;
}
}
close LOG;
print "Found a total of $valueCount values in $lineCount lines\n";
__END__
-Tom Kinzer
-----Original Message-----
From: danield [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 07, 2003 8:43 PM
To: [EMAIL PROTECTED]
Subject: Reading from a log - still a problem
Hello all,
I have received a solution for my problem (reading from log) from Tom
Kinzer. The code is:
#!/usr/bin/perl -w
use strict;
my $log_file = "/appl/log/00004e4d/20031130.txt";
open LOG, "< $log_file" or die "Could not open file $!";
while ( <LOG> ) {
chomp;
if ( /^GTotal Content:/ ) {
my ($gtotal_content, $value) = split(/:/, $_);
print $value;
}
}
close LOG;
The problem is this code returns no value. When I remove all preceding
lines from the log (20031130.txt) and keep there only that GTotal
Content: 14,741,322, I will get desired result (14,741,322)
What may be a solution for this?
Thank you for your time.
danield
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>