my $headers = HTTP::Headers->new; $headers->header('Content-Type' => 'text/html;charset=UTF-8'); print $headers->as_string; my $template = Template->new({ INCLUDE_PATH => some path, INTERPOLATE => 1, }) || do { my $error = $Template::ERROR; my $q = new CGI; error($q, "Caught error: " . $error); }; my $link = ""; foreach my $key (keys %referencesData) { $link = $referencesData{$key}; # Here it is where html is invoked and first iteration works ok, but next it does not do anything $template->process('template.ttml', { link => $link } ) || do { my $error = $template->error(); my $q = new CGI; error($q, "Caught error: " . $error); }; } #### [%# template.ttml %] Some title