in reply to Reset STDERR to console

As you'd know, by default, STDERR points to STDOUT.

After you have manipulated the file, as mentioned in the code above, you can point STDERR back to STDOUT using the following code:
*STDERR = *STDOUT;

Hope this helps!

Sumeet Grover.

Replies are listed 'Best First'.
Re^2: Reset STDERR to console
by moritz (Cardinal) on Apr 01, 2011 at 10:11 UTC
    As you'd know, by default, STDERR points to STDOUT.

    Oh really?

    $ perl -le 'print STDOUT foo' 1>/dev/null $ perl -le 'print STDERR foo' 1>/dev/null foo

    So, not true.

    The solution to the original question involves saving the old STDERR in a variable before reopening it. If I remember correctly, perlopentut talks about that.

      It would have been accurate to say that the IO handles for STDERR and STDOUT are assigned to the same device rather than that one IO handle is assigned to the other.

      One world, one people

        Not really. STDOUT and STDERR default to be the same as the parent's STDOUT and STDERR respectively. There is no relation to devices.
    A reply falls below the community's threshold of quality. You may see it by logging in.