Wild guess: in both your examples you die in any case. This means that the program terminates with an exit value that is not null, i.e. technically, it fails. That is, it may not be an error, but exactly what is supposed to happen. Have you tried s/die/print/?

What are you really trying to achieve? What did you expect to happen?

perl -e "sub { @_ = sub {@_}->(@_); fork ? die 5 : die 6 }->(2)"

Hmmm... here you dereference a subref passing in 2 as an arg. Then you pass the whole argument list, that is (2), to another anonymous sub that will just return its arguments, and assign that back to the argument list, which is not changed after all. Having done all this you don't do anything with the input value, but simply fork and die both if you're the "forked" process or the parent one - or if the fork failed.

perl -e "sub { @_ = 3; fork ? die 5 : die 6 }->()"

Less byzantine, but still @_ = 3; does nothing, really.


In reply to Re: Reality checking a win32 perl bug by blazar
in thread Reality checking a win32 perl bug by bsb

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.