Perl Programming/Keywords/pack

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: our Keywords Next: package

The pack keyword[edit | edit source]

pack takes a LIST of values and converts it into a string using the rules defined in the TEMPLATE. The string returned is the concatenation of the appropriately converted values.

Syntax[edit | edit source]

  pack TEMPLATE, LIST

Example[edit | edit source]

Following code
 pack("n/a* w/a", "hello,", "world")
outputs the line
"\000\006hello,\005world"

See also[edit | edit source]

Previous: our Keywords Next: package