in reply to Copy contents of STDOUT

I'm not sure I understand from your question quite what you are trying to achieve but I wonder if IO::Tee might serve your needs.

Cheers,

JohnGG