in reply to How do I restore STDOUT

IIRC, open(STDOUT, '>-') will do the trick.

Originally posted as a Categorized Answer.