in reply to Create HTML reports using HTML Template
You need to move the @loop and @nameloop declarations inside the "for my $customer" loop. Currently you loop through each customer, adding to these arrays, but never emptying them in between customers.
Also, I haven't tested this last bit, but I believe you can move your
my $template = HTML::Template->new
outside the loop, and then just call
$template->clear_params();
at the bottom of the loop before you proceed to the next customer. Either that or use the HTML::Template caching option, so you don't have to re-parse the template with each customer.