Since you are using the
system command to execute these programs then the pipe is managed by a shell, so to get the return code (other than the last one) you need a shell solution.
If you use Bash then you can access the pipe return code using the array PIPESTATUS, recent Korn shell version support one called 'pipefail'.
You would probably be better managing the pipe yourself in Perl through
open, and you will find that you don't need tee(1).