open (FILE, "$indx_tem") or die " $indx_tem: $!"; open (FILE1, ">$indx") or die "$indx: $!"; while () { # 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 => *FILE1); last;