i.e. Your comment should be on just the one line, anneq. This might have been a copy-and-paste error (from you local server to the remote, or from your local server to the Monastery, not sure which), which is why you should use <code> tags to include code in your posts.
This also should have produced an error. Did you check for errors? Hint: run it from the console before you test it on the web.
(I also recommend you use strict in all your scripts to make sure you're generally declaring your variables, etc. correctly. It's a bit of bondage that encourages good coding practices.)
# send the obligatory Content-Type and print the template output
print "Content-Type: text/html\n\n", $template->output;