I too have been hacking Perl for quite some time (four years or so, although almost never as my full-time job) and have trouble with pack. I stared at this for a few, brief moments of total confusion before firing off a /msg to The Schwartz and asking for a hint.* Essentially what unpack is doing in that example is defining spacing and data types for each token in the string and returning a list of formatted tokens, which is summarily joined. Crazy stuff.

I've also found that pack/unpack are used far less than they were "back in the day."

Good luck. I look forward to reading this FAQ when you're through.

(merlyn cruelly deferred me to the perldocs for pack/unpack. In hindsight, I don't mind so much, because (I think) I actually learned something. :)


In reply to Re: Confession of a Perl Hacker by mwp
in thread Confession of a Perl Hacker by dkubb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.