in reply to Check system return codes

IPC::Run will also let you check piecewise parts of a long pipe chain. But if you really just want tee's functionality you can trivially re-implement it in Perl yourself (open a pipe from $cmd, write output to your output file and STDOUT, return the exit status you get when you close the pipe).

The cake is a lie.
The cake is a lie.
The cake is a lie.