It seems to me, that wrapping your code into Capture::Tiny->tee (which internally uses IO::TeeHandle) would solve your problem.
In reply to Re: Printing both to console and File
by soonix
in thread Printing both to console and File
by perluser455
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |