tmplloop.cgi

#!/usr/local/bin/perl
use strict;
use HTML::Template;

my $tmpl = HTML::Template->new(filename => 'tmplloop.tmpl');

$tmpl->param( NAME => "Palmo", COLOR => "White");

$tmpl->param( FRUITS => [
                { NAME => "Apple",  COLOR => "Red" },
                { NAME => "Banana", COLOR => "Yellow" },
                { NAME => "Peach",  COLOR => "Pink" },
              ] );

print "Content-Type: text/html\n\n", $tmpl->output;

tmplloop.cgi J