in reply to Values returned to Perl

Sure it's easy enough to collect the return code (if any) from another failing program, after it was invoked from Perl..

What if an external program terminates with a single error code -- but for different causes, while additionally printing errors to standard output?
You didn't mention your platform, but at least on Unix and for some Windows programs, you could invoke your program from Perl along with some extra flags, redirecting any errors into a disk file, which your Perl script can read and analyze..
/my/prog 2> /private/debug-output.txt
To specifically answer your question 2: As others had said $? is what you need - but first find out what error codes your external program can return - that way you'll know what to match for in your Perl program.

At least there's one idea - but how you implement depends on a few variables - your program, what else it does, lots of things... if you post some code we'll get a better idea of your final intent..

If all you're looking to do is find out when your program died, use a wrapper script that tries to restart it and notify you ..