Tux: >> Does this pack overview help you? AnomalousMonk >> See also perlpacktut. Your sage advise to RTF_PACK_M was supererogatory in this case. Reading the first reply from Tye, one would have seen that the PACK code was correct: >> by tye on Aug 15, 2015 at 05:39 UTC >> Congratulations, you did it on your first try. >> printf("... c16=0x%04hx ...", ..., $c16, ...; Examining the original post, the salient parts of the perldoc, pack.html manual were quoted directly, credited and even correctly applied: -------------------------------- http://perldoc.perl.org/functions/pack.html pack TEMPLATE,LIST The TEMPLATE is a sequence of characters that give the order and type of values, as follows: S An unsigned short value. $count=17767; # C=0x4567=Dec17757 $c16 = pack("S", $count); # Pack COUNT to ---------------------------- The transcript shows extensive manual labor and myriad attempts of variations on the theme to figure the "PACK" problem out before bothering The Monks. As Tye pointed out, the problem was NOT with PACK. The bonehead maneuver was trying to use printf to verify packed values. Unpack was necessary to debinarate the data to values printable by Perl. This might be a useful caveat for the Tutorial. Don't do this at home! I knew it would be something simple that was right in front of me. To quote Homer, D'oh! << the Famous Homer Brian

In reply to Re^2: Pack number to unsigned short by BrianP
in thread Pack number to unsigned short by BrianP

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.