in reply to How can I re-open STDOUT?

Courage,
OWTDI is to save it off first (also in perldoc -f open):
#!/usr/bin/perl -w use strict; open (SAVEOUT, ">&STDOUT") or die "Unable to save STDOUT : $!"; open (STDOUT, ">my_log") or die "Error with redirecting STDOUT : $!"; # More code passes open (STDOUT, ">&SAVEOUT") or die "Unable to restore STDOUT : $!";
Cheers - L~R

Replies are listed 'Best First'.
Re: Re: How can I re-open STDOUT?
by Courage (Parson) on Aug 07, 2003 at 12:42 UTC
    Indeed, I should have to save handle first, and all my code will work afetr that.

    But then, it seems to me that documentation is not clear enough: it states it will *open* STDOUT even if it was closed before.

    Moreover, your example of code does not contains >- anymore.

    Thank you for help!

    Courage, the Cowardly Dog