http://www.perlmonks.org?node_id=11128968


in reply to Three argument version of open '>-' (updated)

same behavior for me

DB<47> open $fh,">-" DB<48> say $fh "bla" bla DB<49> say "bla" bla DB<50> close STDOUT DB<51> say $fh "bla" DB<52>

copy solution

DB<53> say "bla" bla DB<54> $fh=\*STDOUT # copy DB<55> say $fh "bla" bla DB<56> close STDOUT DB<57> say $fh "bla" DB<58>

what am I missing?

EDIT: Both approaches warn under warnings if STDOUT was closed.

UPDATE

I just remembered that the debugger does scary redirections under the hood, so these tests may not be reliable.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery