open NEW_TEMPLATE, "> $indx" or die "Cannot open ($indx) for writing: $!"; # open the HTML template my $template = HTML::Template->new(filename => $indx_tem); # fill in some parameters in the template $template->param(Location => $Location); $template->param(Number => $Number); $template->param(word => $word); # print the template to file $template->output(print_to => *NEW_TEMPLATE);