The 'N' template will always give an unsigned 32-bit value which will be the same on big or little endian hardware.

The 'l' template gives a signed 32-bit value which will be different on big or little endian hardware. See the pack() perldoc.

So in answer to your question, this is normal behaviour. If you are getting different behaviour on Windows it shouldn't be due to this line of code, per se, but rather to how the return value is used. *

In this particular case I'd guess that the issue isn't that the pid is being unpacked as 'N' or 'l' but rather that it is being repacked as 'I' rather than 'N'. That is just a guess though, without digging further into the code.

* What seems strange about using 'l' in this case is that it could give a negative pid on Windows. Is that valid? If not then it is an indication that the problem lies elsewhere.

P.S. The '1' in the unpack templates is superfluous and in the case of 'l1' a little confusing.

--
John.


In reply to Re: signed and unsigned templates in pack/unpack by jmcnamara
in thread signed and unsigned templates in pack/unpack by posti

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.