in reply to Robustly piping several processes.

Use "<&".fileno($out_fh1) as $in_fh2. Also open cmd3.log on a filehandle, and pass that in as the err_fh to each command in sequence.

Untested, but the documentation indicates that that should work.