in reply to Re^2: eval error
in thread eval error

I think you want to look at IO::Tee

Caution: Contents may have been coded under pressure.