oh! well that's pretty simple, and you have a few alternatives.
{
local @ARGV = ('file1', 'file2', ...);
while (<>) {
chomp;
...
}
}
or
foreach $filename ('file1', 'file2', ...) {
local *RPT;
open(RPT, '<', $filename)
or die("...\n");
while (<RPT>)
{
chomp;
...
}
}
or
sub read_log {
my ($filename, $analysis_ref) = @_;
local *RPT;
open(RPT, '<', $filename)
or die("...\n");
while (<RPT>)
{
chomp;
...
if (exists($$analysis_ref{$key}))
{
$$analysis_ref{$key} .= $msg;
}
else
{
$$analysis_ref{$key} = $msg;
}
...
}
}
my %analysis;
read_log($_, \%analysis)
foreach ('file1', 'file2', ...);
|