I am sorry, I posted this at 5 am or so my time and had not had any redbull yet =) here is what i meant to say: If (0,28,48,54,60,62,76,126) = (0000,1000,0100,1100,0010,1010,1110,0001) then you can encode the original array as:
[0000,1100,1000,1110,0001,0000,1000,1100,1010,1100,0000,1000,1100,0010 +,0100,0000,1100,1100,1010,1100,0000]
or as bits:
0000110010001110000100001000110010101100000010001100001001000000110011 +00101011000000
then convert to 12 bytes (filling the last 4 bits with 1111 to tag padding). to get the data back you need to chomp 4 bits per array slot until done or you hit 1111
0,54,28,76,126,0,28,54,62,54,0,28,54,60,48,0,54,54,62,54,0
stored in a file is 58 bytes. As long as the set of unique numbers stays fixed or less than 15 you can save space storing in this way and the larger the array the more savings you will see.

it was really silly anyways because you will note for such a small set the perl code to compress/decompress + the data compressed is larger than the starting data =)

-Waswas

In reply to Re: Re: pack unpack charcount repetition by waswas-fng
in thread pack unpack charcount repetition by denthijs

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.