in reply to Template::Toolkit + CGI header

yup, Template Toolkit prints the template to STDOUT by default.

replace: $output .= $template->process($file, $vars) || with: $template->process($file, $vars, \$output) ||

and it should append the template to $output.

or..

replace: my $output = "Content-type: text/html\n\n"; with: print "Content-type: text/html\n\n";

and get rid of the print $output statement at the end.

I prefer the first option as you can then pass the content to other subs, back to the caller, print it to a file, or anything else you may want to do with it..

cheers,

J