my $template = HTML::Template->new(filename => $temp_late, die_on_bad_params => 0); my @loop; # the loop data will be put in here # fill in the loop, sorted by timestamp foreach $count (sort keys %table) { # get the other data from the data hash ($eenie,$meenie,$minie,$mo,) = @{table{$count}}; # make a new row for this data - the keys are names # and the values are the values to fill in the template. my %row = ( eenie => $eenie, meenie => $meenie, minie => $minie, mo => $mo, ); # put this row into the loop by reference push(@loop, \%row); } # call param to fill in the loop with the loop data by reference. $template->param(member => \@loop); # print the template print $template->output;