Perl Programming/Keywords/pack

Previous: our Keywords Next: package

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

Previous: our Keywords Next: package
Category:Book:Perl Programming#Keywords/pack%20
Category:Book:Perl Programming