in reply to Re: Why is pack("N",42949672965) giving me 00 00 00 05
in thread Why is pack("N",42949672965) giving me 00 00 00 05

You know you can use 0xFFFFFFFF, right?

Replies are listed 'Best First'.
Re^3: Why is pack("N",42949672965) giving me 00 00 00 05
by AnomalousMonk (Archbishop) on Feb 09, 2015 at 03:32 UTC

    ... or even 0xFFFF_FFFF or 4_294_967_295 for that matter.


    Give a man a fish:  <%-(-(-(-<

      Why not simply use -1?

      $ perl -MDP -we'DHexDump pack ("N", -1)' 0000 ff ff ff ff .... $ perl -MDP -we'DHexDump pack ("Q", -1)' 0000 ff ff ff ff ff ff ff ff ........

      Enjoy, Have FUN! H.Merijn
        Aside from the fact that N is suppose to take an unsigned integer, your very question demonstrates that -1 and 0xFFFF_FFFF pack differently.
      @AnomalousMonk: well, didn't know that. but never liked the underscore notation for numbers, anyway... :)
Re^3: Why is pack("N",42949672965) giving me 00 00 00 05
by isync (Hermit) on Feb 09, 2015 at 18:22 UTC
    @ ikegami: yes, knew that.
      It was a rhetorical question. The implication is that you should have used 0xFFFF_FFFF. If you had, you wouldn't have made the error you did.
        :) of course. Thanks again!