#!/usr/local/bin/perl -w
use warnings;
use strict;
use Template;
eval{
my $ttConfig = { INCLUDE_PATH => './' };
my $tt = Template->new( $ttConfig );
my $output;
my $param = {
message => 'hello!' ,
test => 'world!!',
};
$tt->process( 'test.tt', { param => \%{$param} }, \$output ) ;
print $output;
};if(my $error = $@){
print "$error\n";
}
1;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>[% param.message %] [% param.test %]</title>
</head>
<body>
<h1>[% param.message %]</h1>
<h2>[% param.test %]</h2>
</body>
</html>