In your Perl code, you would just say: use HTML::Template(); # open the html template my $template = HTML::Template->new(filename => 'index.html'); # Fill in various parameters here ... # Send header here ... # print the template print $template->output;