A packed string is basically a base 256 integer. For example, the string 'AB' would represent the integer 65 + 66 * 256 (65 and 66 being the ASCII codes of A and B respectively).
The H format asks pack to treat the next argument as an hexadecimal string. Since 15 is an integer, it is first converted to the string '15', which is then parsed as an hex-string, giving the number 21 (1 * 16 + 5). This number is then encoded in base 256, giving the character with ASCII code 21.
pack('H*', 15) eq chr 21
Since chr 21 isn't a printable character (it's actually Negative Acknowledge), it is rendered with this weird symbol you saw. This is largely system-dependant.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.