in reply to How to get system -function negative return value?

Maybe this helps:

The return value is the exit status of the program as returned by the [id://perlfunc:wait|wait()] call. To get the actual exit value divide by 256. See also exec.

See perldoc -f system

See also Perl 5.8.4 perldoc system where the new page says: "To get the actual exit value shift right by eight (see below)."

  • Comment on Re: How to get system -function negative return value?

Replies are listed 'Best First'.
Re: Re: How to get system -function negative return value?
by Anonymous Monk on May 27, 2004 at 09:22 UTC
    Thanks, but I exactly ment already divided value :-(

    Code:

    my $return_value = system("test.exe something");
    returns 0-65280, negative value is always 65280

    and when divide it

    $return_value = $return_value/256;
    it returns naturally 0-255

    Maybe I should use some other function. Any suggestions?

      As I said in another post:
      $ perl -wle 'print unpack c => pack C => 65280 >> 8' -1

      Abigail