in reply to Redirecting STDOUT to file and screen as an afterthought, on Windows.

How about:
if ($resp =~ /^y/i) { $log = IO::Tee -> new(">stdout.txt", \*STDOUT); } else { $log = *STDOUT{IO}; }
Then just print everything to $log.

Cheers

  • Comment on Re: Redirecting STDOUT to file and screen as an afterthought, on Windows.
  • Download Code