

When used with Z, a * as the repeat count is guaranteed to add a trailing null byte, so the resulting string is always one byte longer than the byte length of the item itself. If the template in brackets contains alignment commands (such as x!), its packed length is calculated as if the start of the template had the maximal possible alignment. One can replace a numeric repeat count with a template letter enclosed in brackets to use the packed byte length of the bracketed template for the repeat count.įor example, the template x skips as many bytes as in a packed long, and the template "$t X $t" unpacks twice whatever $t (when variable-expanded) unpacks. U, where it is equivalent to 1 (or 45, which here is equivalent). and, where it means relative to the start of the string. JJfFdDpP (The "big end" touches the construct.) > sSiIlLqQ Force big-endian byte-order on the type. ! Specify position as byte offset in the internal ! nNvV Treat integers as signed instead of unsigned. ! xX Make x and X act as alignment commands. One or more modifiers below may optionally follow certain letters in the TEMPLATE (the second column lists letters for which the modifier is valid): ! sSlLiI Forces native (short, long, int) sizes instead Null-fill or truncate to absolute position specified by

X Back up a Null-fill or truncate to absolute position, counted from the X A null byte (a.k.a ASCII NUL, "\000", chr(0)) Bit eight (the high bit) is set on each byte Its bytes represent an unsigned integer inīase 128, most significant digit first, with as few digitsĪs possible. W A BER compressed integer (not an ASN.1 BER, see perlpacktutįor details). This allows most programs using this feature to not have toĬare which type of platform they are running on. Also on EBCDIC platforms, the character number willīe the native EBCDIC value for character numbers below 256. Encodes to a character in char-Īcter mode and UTF-8 (or UTF-EBCDIC in EBCDIC platforms) inīyte mode. P A pointer to a structure (fixed-length string). Note that there are different long double formats.) (Long doubles are available only if your system supports J A Perl internal unsigned integer value (UV).į A single-precision float in native format.ĭ A double-precision float in native format.į A Perl internal floating-point value (NV) in native formatĭ A float of long-double precision in native format. J A Perl internal signed integer value (IV). V An unsigned long (32-bit) in "VAX" (little-endian) order. V An unsigned short (16-bit) in "VAX" (little-endian) order.

N An unsigned long (32-bit) in "network" (big-endian) order. N An unsigned short (16-bit) in "network" (big-endian) order. Size depends on what a local C compiler calls 'int'.) (This 'integer' is _at_least_ 32 bits wide. Integer values _and_ if Perl has been compiled to support (Quads are available only if your system supports 64-bit W An unsigned char value (can be greater than 255). Z A null-terminated (ASCIZ) string, will be null padded.ī A bit string (ascending bit order inside each byte,ī A bit string (descending bit order inside each byte). The TEMPLATE is a sequence of characters that give the order and type of values, as follows: a A string with arbitrary binary data, will be null padded.Ī A text (ASCII) string, will be space padded. See perlpacktut for an introduction to this function. For example, on 32-bit machines an integer may be represented by a sequence of 4 bytes, which will in Perl be presented as a string that's 4 characters long. Typically, each converted value looks like its machine-level representation. The resulting string is the concatenation of the converted values. Takes a LIST of values and converts it into a string using the rules given by the TEMPLATE.
