|
|
From: John W. Krahn [mailto:krahnj@xxxxxxxxx]
Sent: Thursday, September 13, 2007 2:01 PM
To: Perl beginners
Subject: Re: adding data to a file before it gets regexed
Moon, John wrote:
> From: John W. Krahn [mailto:krahnj@xxxxxxxxx]
>>
>> Here is another way to do it:
>>
>> my $logs_total = () = <*log>;
>> my $processed = @ARGV = <access_sun83*log>;
>> my %logs;
>> $logs{ $ARGV }++ while <>;
>>
>> print "There are $logs_total logs HERE\n";
>> print "I processed $processed logs\n";
>> for my $filenm ( sort keys %logs ) {
>> print "There are $logs{$filenm} items in $filenm\n";
>> }
>
> John
> [>>]
> Look like it gave someone some ideas... ;-)
>
> Since we're "going there" you _should_ also check on *close* (on an
> output file) - may save you a lot of time...
>
> As for slurping in a "log" file ... some can be *very* large...
Nowhere in the code that I posted are the "log" files being "slurped
in", only
one line is being read at a time.
John
[>>] Please excuse my error...
jwm
|
|