#! /usr/bin/perl use warnings; use strict; use HTML::Template; use Data::Dumper; my $text = "bar=\n"; my $template = HTML::Template->new(scalarref => \$text, loop_context_vars => 1); my @a = ({bar => 10}, {bar => 20}); $template->param(foo => \@a); my @array = $template->param('foo'); print Dumper(@array); $template->param(foo => \@array); $template->output;