#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI ':standard'; use HTML::Template; my $h="path/test.html"; # open the HTML template my $template = HTML::Template->new(filename => 'test.tmpl'); # fill in some parameters in the template $template->param(home => $ENV{HTTP_HOST}); $template->param(path => $ENV{PATH}); # send the obligatory Content-Type print "Content-Type: text/html\n\n"; open(FILE,">$h") || die "Failed opening file: $!"; print FILE "$template->output"; close FILE; print "okay";