Still cant figure out..and make it work..
These are my suggested changes:
$hash{$fields[1]}= [$fields[0],$fields[2],$fields[3],$fields[4],$fields[5],$fields[6],$fields[7],$fields[8],$fields[9]] if ($fields[10] == "$epoch" ) ;
Replace that line with:
push @{ $hash{$fields[1]} }, [ @fields[0,2..9] ] if $fields[10] == $epoch;
Then you need an inner foreach loop inside the current foreach loop in the mail_report() function.
foreach my $key (keys %hash) {
foreach my $line ( 0 .. $#{ $hash{$key} } ) { # inner loop begins
open (MAIL, "|$sendmail -t"); print MAIL "Return-Path: [EMAIL PROTECTED]"; print MAIL "To: <$hash{$key}[0]>\n";
Change that line to:
print MAIL "To: <$hash{$key}[$line][0]>\n"; --------------------------------^^^^^^^
<snip>
<td><center>$hash{$key}[2]</center></td>
Change that line to:
<td><center>$hash{$key}[$line][2]</center></td> ---------------------------^^^^^^^
<td>$hash{$key}[3]</td> <td>$hash{$key}[4]</td> <td>$hash{$key}[5]</td> <td><center>$hash{$key}[6]</center></td> <td><center>$hash{$key}[7]</center></td> <td><center>$hash{$key}[8]</center></td> <td><center>$hash{$key}[9]</center></td>\n";
(Similar changes to all those lines.)
} # inner loop ends
}
That's it.
%hash is now a hash of arrays of arrays ( previously it was a 'simple' hash of arrays ;-) ). Start learning about Perl data structures at http://www.perldoc.com/perl5.8.4/pod/perldsc.html
There is a lot more to say about your script, but I stop here for now.
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>