When would you use unpack('h*' …) or pack('h*' …)?

后端 未结 3 1242
广开言路
广开言路 2020-12-31 09:16

In Perl, pack and unpack have two templates for converting bytes to/from hex:

h    A hex string (low nybble first).

3条回答
  •  难免孤独
    2020-12-31 09:51

    I imagine this being useful when transfering data to or reading data from a machine with different endianess. If some process expects to receive data the way it would normally represent it in memory, then you better send your data just that way.

提交回复
热议问题