Returns the equivalent of the given number using the specified base. The default radix is 64. Bases greater than 10 will be more compact than the original number. Bases less than 10 will be more expanded.
The inverse function of pack() is unpack(). pack() and unpack() are designed to support the base-36 radix conversion used in Myrddin's popular Bulletin Board. For this reason, and to support bases: 2, 8, and 16, this conversion is not the radix-64 conversion used in unix-to-unix copy (uuencode).
Related Topics: unpack()
- >think pack(629126998)
- >think pack(629126998,16)
- >think pack(629126998,2)
- >think pack(-629126998)
- A common computer joke asks, "Why do programmers get Christmas and Halloween confused? Because DEC 25 equals OCT 31!" With pack() we can prove this by converting the DECIMAL number 25 to OCTAL (base 8) as follows:
- > say pack(25, 8)
- You say, "31"
(--Soylent 01:29, 3 December 2005 (EST))