I'm going to ignore the j
, J
, f
, F
, d
, D
, p
, P
, u
, w
template characters.
I'm running this on a system with x86_64
architecture (little endian) with perl-5.38-2
, sizeof(int) == 4
.
pack TEMPLATE, LIST
takes LIST
and packs it into a string according to TEMPLATE
. E.g. pack('ac', 'a', 1)
returns "a\x01"
. There are two template charaters here: [a
][aa] and [c
][ac]. Each template character tells pack()
what to do with the next argument: [a
][aa] to take one character from the first argument ('a'
), and put it into the resulting string, [c
][ac] to take the next argument (the 8-bit signed integer 1
), and add chr(1)
to the resulting string.
Template characters differ in what values they take: