thanks for the reply. I was looking to the source code of Tie::STDOUT. He basically solves it with something like:
open(my $stdout, ">&", STDOUT);
...
# in the overloaded method PRINT
$stdout->print( @_ ); # this refers to the original STDOUT.
I guess this opens a different underlying file handle, while my $oldhandle = STDOUT is an assignment/alias to the same file handle used by STDOUT.
s.fox |