sub template_s_r { my ($lineref, $dataref) = @_; my $val; my $tt = Template->new({ ENCODING => 'utf8' }); $tt->process(\$lineref, $dataref, \$val, {binmode => ':utf8'}) or die $$tt->error, "\n"; return $val || 0; }