# file test.pl
use HTML::Template;
use strict;
use warnings;
my $template = HTML::Template->new(filename => 'test.tmpl');
# params
$template->param(tag1_common => 'XXX');
$template->param(tag2_common => 'YYY');
$template->param(tag3_common => 'ZZZ');
print $template->output();
# file test.tmpl
# output
XXX
YYY
ZZZ
####
# file test.pl
use HTML::Template;
use strict;
use warnings;
my $template = HTML::Template->new(filename => 'test.tmpl');
my @xml = (
{
parent => 'tag1',
common_value => 'XXX',
},
{
parent => 'tag2',
common_value => 'YYY',
},
{
parent => 'tag3',
common_value => 'XXX',
},
);
# params
$template->param( loop => \@xml );
print $template->output();
# file test.tmpl
<>
>
# output
XXX
YYY
XXX