unpack

unpack

unpack TEMPLATE,EXPR

unpack TEMPLATE

unpack does the reverse of pack: it takes a string and expands it out into a list of values. (In scalar context, it returns merely the first value produced.)

If EXPR is omitted, unpacks the $_ string. See perlpacktut for an introduction to this function.

The string is broken into chunks described by the TEMPLATE. Each chunk is converted separately to a value. Typically, either the string is a result of pack, or the characters of the string represent a C structure of some kind.

The TEMPLATE has the same format as in the