2007/4/26, Nath, Alok (STSD) <[EMAIL PROTECTED]>:
Hi ,
       Can somebody help me out ?

       I wanted to switch io redirection between log file and
       standard display device.Basically sometimes I want to
       print into a log file and other time to the display device.

       To redirect I am using this

       open (STDOUT, ">> TEST.log)

       Two doubts here -
       1. I don't know how to reset it to default i.e to point STDOUT
to display again.
       2. Is there any better way of doing above ?


Hi,

Using "select" to do this thing is maybe better.

open FILE,">>",$logfile or die $!;
my $old = select FILE;
print "some things...";  # print to logfile
select $old;  # select back to STDOUT
print "other things..."; # print to STDOUT


--
Chinese Practical Mod_perl book online
http://home.arcor.de/jeffpang/mod_perl/

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


Reply via email to