in reply to Need a 16 bit returncode from .exe

Here's a hackish, possible solution. From perl, invoke a small .CMD wrapper that calls the program and then echoes %ERRORLEVEL% when the command terminates.

In your perl code, assign the return from the backticks to an array. When the command completes, the return code will be the last line of that array:

The .cmd wrapper:

rem I called this errorlevel.cmd @%1 %2 %3 %4 %5 %6 %7 %8 %9 @echo %ERRORLEVEL%

An example use:

my @out = `errorlevel.cmd perl -le"print for 1 .. 10; exit 12345;"`;; print pop @out;; 12345 print join '', @out;; 1 2 3 4 5 6 7 8 9 10

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."