< Perl Programming < Keywords

The pack keyword

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

  pack TEMPLATE, LIST

Example

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

See also

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.