in reply to Re: Binary data
in thread Binary data

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';