http://www.perlmonks.org?node_id=682926


in reply to Re: How to optionally kill a child, and capture status if not killed.
in thread How to optionally kill a child, and capture status if not killed.

Thanks pc88mxer!

Great tips.

The key was to wait for either process to finish in the parent, and to use "exec" instead of "system" to not consume the status read by "$?". Before that, I could not get "$?" to reflect the status.

I will update the example for any future searches.