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 <[EMAIL PROTECTED]> wrote:
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 commands
1,2, & 3,  to the logfile  in a unix shell script.

Janeen

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to