#!/usr/bin/perl
use strict;
use warnings;
use HTML::Template qw();
use CGI qw();
my $fName = 'sample.html';
open my $temp, '>', $fName or die "Can't create $fName: $!\n";
print $temp <<'HTML';
HTML
close $temp;
my $tmpl = HTML::Template->new(filename => $fName);
my @fields = qw(Hello Goodbye Friend Adios Amigo);
my @loopParams = map {{div => $_}} @fields;
print CGI::header();
$tmpl->param(title => "testme");
$tmpl->param(divname => 'div-test');
$tmpl->param(divs => \@loopParams);
print $tmpl->output();