It is good to know that pack works. I don't need to dump the binary RGB key to one file and the count data to another file and write a c program to merge them! Perl stores its ints at type j/J rather than binary. I have been doing too much C!!! Maybe I can spend a few more hour and figure out how to UNPACK a binary blob into a string of 1s and 0s. Just to make sure I am on the right page here... $count=17767; # C=0x4567=Dec17757 $c16 = pack("S", $count); # Pack COUNT to uint16 $ctest = unpack('S', $c16); # Pull it back out??? printf("C=$count = %x, CT=$ctest = %x\n", $count, $ctest); -> Running C:\bin\bb.pl Sat Aug 15 01:42:41 2015 C=17767 = 4567, CT=17767 = 4567 Holy Guacamole! The Pack is Back!! Thanks 1E6 or 11110100001001000000 :)

In reply to Re^2: Pack number to unsigned short (printf) 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.