use strict;
use HTML::Template;
my $data = do {local $/; };
my $tmpl = HTML::Template->new(scalarref => \$data);
my $rows = [
{ col1 => 'Graham Chapman', col2 => 'John Cleese' },
{ col1 => 'Terry Gilliam', col2 => 'Eric Idle' },
{ col1 => 'Terry Jones ', col2 => 'Michael Palin' },
{ col1 => 'Terry Jones ', col2 => 'Michael Palin' },
{ col1 => 'Terry Gilliam', col2 => 'Eric Idle' },
];
my $i = 0;
my @class = qw(one two three);
$tmpl->param(
rows => [
map {
{ %$_, class => $class[$i++ % @class] }
} @$rows
],
);
print $tmpl->output;
__DATA__