Hi Janeen,
To redirect STDOUT and STDERR, simply open them for writing with
whatever file name you want to log to. For example
#!/usr/bin/perl
print "I'm written to the consonle\n";
open STDOUT, '>', 'log.txt';
print "I'm written to a log file\n";
Hope that helps.
-Jason
On 1/16/07, Janeen <
Hello All:
Is there a way to re-direct the output of a perl script to a log file,
from within the perl script? I'm looking for the perl equivalent of the
following:
{
command 1
command 2
command 3
} 2>> ${LOG} 1>&2
which would redirect anything written to STDOUT and STDERR, by comm