Edit. Actually, different groups aren't necessary:

>perl -wE "say for unpack '(CX/xX.@0x/A)*', qq(\03ab\05cdef\06ghijk)" ab cdef ghijk >perl -wE "say for unpack '(CCXX/xXX.@0xx/A)*', qq(\x03\x04Hi\x43\x08H +ello!)" 3 Hi 67 Hello!
>perl -wE "say for unpack '(C/xX2.@0x/A)(CX2/x.@0x/A)*', qq(\03ab\05cd +ef\06ghijk)" ab cdef ghijk >perl -wE "say for unpack '(CC/xX4.@0xx/A)(CCX4/x.@0xx/A)*', qq(\x03\x +04Hi\x43\x08Hello!)" 3 Hi 67 Hello!

Either 1st or last group is built differently, so as not to hit "X(x) outside of string in unpack".


In reply to Re: unpack less than indicated length by vr
in thread unpack less than indicated length by paulrh

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.