http://qs321.pair.com?node_id=590216


in reply to Re: Suppress/Reactivate STDERR
in thread Suppress/Reactivate STDERR

STDERR is not necessarily the same thing as file descriptor 3
s/3/2/

In recent Perl there's no need to use package variables for file handles to achieve this.

open my $olderr, '>&', \*STDERR or die $!; #... open STDERR, '>&', $olderr or die $!;

Replies are listed 'Best First'.
Re^3: Suppress/Reactivate STDERR
by ikegami (Patriarch) on Dec 16, 2006 at 18:07 UTC

    Re: 2 vs 3 -- Thanks, typo!

    Re: lexical file handles -- True. I just went along with the code that was already there. Lexicals can be used for file handles since Perl 5.6.0.