#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; use CGI; use HTML::Template; # create query object with some params # (straight from the docs) :-) my $q = new CGI( { 'dinosaur' => 'barney', 'song' => 'I love you', 'friend' => 'george', } ); # create data structure for HTML::Template my @param_loop = map { {name => $_, value =>$q->param($_), } } $q->param; # get the template from DATA (this would normally be in a file) my @tmpl = ; # blast off! my $t = HTML::Template->new(arrayref => \@tmpl); $t->param(param_loop => \@param_loop); print $t->output; __DATA__ template

->

#### template

friend -> george

song -> I love you

dinosaur -> barney