in reply to A template module question

My guess is really going to be that it is your select code, just because this code is playing no obvious games that would cause problems, and I know how often I have made simple mistakes leading to my thinking things like that. (I prefer to admit to the number of times that I have seen others make that kind of mistake..) Try this pattern:
my $file = "output.txt"; open (FOO, "> $file") or die "Cannot write '$file': $!"; select(FOO); # Do stuff here during which default prints go to the file. # BUT: print STDOUT $string; will still go to STDOUT. It # isn't gone, just ignored by default. select(STDOUT); # If you are going to do a bunch more stuff. close (FOO); # prints here are back to normal.
Another option. Run this and redirect on the command line.
perl yourscript and args > outputfile
Oh, and long-term I strongly recommend moving to Template::Toolkit. But that is another issue.

UPDATE
Another thought just struck me. If the above module is being called in a script you are running with the system command, then it will go to STDOUT even though you have another thing selected. That probably isn't your situation, but just in case...