Similar to how you can use pack's:
N An unsigned long (32-bit) in "network" (big-endian) order.
Is there any method for packing a 64-bit integer in "network" (big-endian) order in Perl?
If your system supports the Q
pack format, you can use Q>
to get big-endian (since Perl 5.9.2):
% perl -e 'print pack("Q>", 1)' | hexdump -C
00000000 00 00 00 00 00 00 00 01 |........|
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With