in reply to Re: Could I redirect stdout back into my script?
in thread Could I redirect stdout back into my script?

If you want the old STDOUT back, You might want to wrap the code in a block and localize STDOUT:
{ my $output_string = ''; local *STDOUT; tie *STDOUT, 'IO::Scalar', \$output_string; stdout_sub(); }
Update: My mistake. The untie does seem to take care of restoring the old STDOUT.

Replies are listed 'Best First'.
Re: Re: Re: Could I redirect stdout back into my script?
by stephen (Priest) on Apr 22, 2001 at 04:17 UTC
    Not a bad idea, but as far as I can tell, it's not necessary. The 'untie *STDOUT' restores the original STDOUT.

    stephen