OK, just checked
perldoc -f open and found that if
you open a pipe from a process, your return code is the pid of the process. Memorize that, read until you can read no longer, then call
wait. Check that you reaped the right process (if you only run one then you darned well should!) and then you have its return code to exit with.