No one said you were dumb. It just seemed like your explaination for what you were trying to do didn't match the code you provided. Also, you might try using <code> and </code> around your code instead of <pre>. That way, your brackets will show up as brackets. Backslashes don't escape things in HTML like they do in source.

The second argument to sysread should be a scalar, not an array. I'm not sure exactly what sysread does when passed an array there. Also, sysread only takes three arguments (at least in 5.6.1).

Your first output looks like junk because you read binary data from a file and printed it. You should expect it to look like junk. Both of the next two prints looked at the same data and interpret it as a bitstring. If the value happens to be zero, both would return a string of 32 '0's.

Could you please provide a C struct definition or other description of what you are trying to parse? It would make it a lot easier for us to help you out.

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

In reply to Re: Re: Binary data by pfaut
in thread Binary data by JunkGuy

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.