You seem to be under the impression that i8 is how you represent int(8). It is not length it is a repeat count so i8 == 'iiiiiiii' or 8 integers 32 bits (4 bytes) wide. A short is 2 bytes.

Here is a more or less complete list of the integer the templates to try. I suspect 'Qssssssssssss' or 'Qvvvvvvvvvvvv' will be close. You will have to use 'LL' or instead of 'Q' if this is not supported on your system. Shorthand is 'Qs12' 'Qv12'

s A signed short value. 16 bits = 2 bytes S An unsigned short value. (This 'short' is _exactly_ 16 bits, which may differ from what a local C compiler calls 'short'.) i A signed integer value. I An unsigned integer value. (This 'integer' is _at least_ 32 bits wide. Its exact size depends on what a local C compiler calls 'int', and may even be larger than the 'long' described in the next item.) l A signed long value. L An unsigned long value. (This 'long' is _exactly_ 32 bits, which may differ from what a local C compiler calls 'long'.) n A short in "network" (big-endian) order. N A long in "network" (big-endian) order. v A short in "VAX" (little-endian) order. V A long in "VAX" (little-endian) order. q A signed quad (64-bit) value. Q An unsigned quad value. (Available only if your system supports 64-bit integer value +s _and_ if Perl has been compiled to support those. Causes a fatal error otherwise.)
cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Unpack for VMS binary files by tachyon
in thread Unpack for VMS binary files by maderman

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.