in reply to Re^2: EXIT code
in thread EXIT code

You could, but it all depends on what you do with standard output; if you want to capture only the errors, and are not interested in standard output, this should work (in bash-like shells:
ERRORTEXT=`perl -e 'die "Oops"' 2>&1 1>/dev/null` ERRORCODE=$?
You can complicate things if you want both standard output and error captures, like:
ERRORTEXT=`perl -e 'print "Hello\n";die "Oops"' 3>&1 1>&2 2>&3` ERRORCODE=$?
Above sniplet prints Hello to standard error(!) and captures the result of 'die' in $ERRORTEXT. But then: why not extend your Perl program to handle what you want in the first place?

Paul