You can open a new filehandle, select() it, and then reselect the old one:
open NEW_STDOUT, '>/dev/null' or die $!; select(NEW_STDOUT); print "Won't be printed\n"; select(STDOUT); close(NEW_STDOUT); print "Printing again\n";
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
In reply to Re: Reopening STDOUT
by hardburn
in thread Reopening STDOUT
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |