Perl Programming/Keywords/unpack

Previous: unlink Keywords Next: unshift

The unpack keyword

unpack does the opposite of pack by taking a string and expanding it out into a list of values. (In scalar context, only the first value produced is returned.)

Syntax

  unpack TEMPLATE, EXPRESSION
  unpack TEMPLATE

Example

my($what, $where, $howmuch) = @_;
unpack("x$where a$howmuch", $what);

See also

Previous: unlink Keywords Next: unshift
Category:Book:Perl Programming#Keywords/unpack%20
Category:Book:Perl Programming