in reply to Redirecting STDOUT to file and screen as an afterthought, on Windows.
if ($resp =~ /^y/i) { $log = IO::Tee -> new(">stdout.txt", \*STDOUT); } else { $log = *STDOUT{IO}; } [download]
Cheers