in reply to Re^3: Trying to translate overflowing JS code to Perl
in thread Trying to translate overflowing JS code to Perl

return unpack( "l", pack "L", ($value & 0xffffffff)))

For which finite numeric values do any of the following 3 renditions differ:
say unpack( "l", pack "L", ($value & 0xffffffff)); say unpack( "l", pack "L", ($value)); say unpack( "l", pack "l", ($value));
Sorry ... I'm not trying to be critical ... not even nitpicking ... but I haven't found any such values, and I'm genuinely curious as to whether they exist.)

Cheers,
Rob

Replies are listed 'Best First'.
Re^5: Trying to translate overflowing JS code to Perl
by Corion (Patriarch) on Nov 29, 2023 at 13:22 UTC

    Yeah - I wasn't sure either. Reconsidering, I think pack "L" and pack "l" both truncate the value to 32 bits already, so masking out higher bits does not make a difference.