use strict; use warnings; use CGI qw(header); use HTML::Template; my $tmpl = HTML::Template->new(filehandle => \*DATA); $tmpl->param( title => 'HTML Sample', toc => 'Table of Contents', body => 'Sample text', ); print header, $tmpl->output; __DATA__ <tmpl_var title>