It would be nice if this was tagged in perlrun somewhere, but it probably the default expectation for unix tools and so doesn't rate a mention.

It isn't. The default for most unix utilities is to just exit with 1 (or 255 for a few)[1]. Test exits with 1 for false condition and 2 for an error. A few programs give a detailed error code depending on the error. I however have never seen any (other than Perl) that would use the ERRNO code as a return value. Ruby exits with 1 no matter what.

Update: I have $? printed in my bash prompt, that's how I know.

[1]: I'm not sure in that.

Update: The glibc manual says

... it does not work to use the value of `errno' as the exit status--these can exceed 255.
This is not yet actual as the errno codes are less than 126 in my system, but there might be much more in later systems. (There are 252 syscalls in linux, they will soon exceed one byte. Lucky the number is stored in %eax so we can have up to 4G syscalls and 2G errno values:)

In reply to Re^4: ActivePerl exit codes by ambrus
in thread ActivePerl exit codes by qadwjoh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.