emjga1 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

The following snipet of code , works fine
But how can I trap the exit code of the program check_nrpe
Which could be 0 , 1 , 2 or 254

open(CMD, "/local/nagios/libexec/check_nrpe -H $host|") or dir $!; @CMD=<CMD>; close(CMD);
I think I should be using fork or waitpid
but not sure how ?.