in reply to A template module question
Another option. Run this and redirect on the command line.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.
Oh, and long-term I strongly recommend moving to Template::Toolkit. But that is another issue.perl yourscript and args > outputfile
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...
|
|---|