jjap has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
This is my first try at handling a binary file. I have successfully slurped a long string of bits into $trailing:
($id, $trailing) = unpack ("A16 x72 B*", $data);
I now need to divide that string into 8 bits x 4 repeatedly over the string, which may vary from file to file but will always be a multiple of 32. I was wondering how to go about this...
(byte2, byte1, byte4, byte3) = ?????
It is likely trivial but I am stumped!
Thanks for any hints...
This is my first try at handling a binary file. I have successfully slurped a long string of bits into $trailing:
($id, $trailing) = unpack ("A16 x72 B*", $data);
I now need to divide that string into 8 bits x 4 repeatedly over the string, which may vary from file to file but will always be a multiple of 32. I was wondering how to go about this...
(byte2, byte1, byte4, byte3) = ?????
It is likely trivial but I am stumped!
Thanks for any hints...
Update Sorry for bothering you, a loop with substr should do it... substr $trailing, 0, 8, "" ;
Update2
To answer the first question of BrowserUK I read the bits because that filled my variable, it did not occur to me to capture the result in an array !! Many thanks to all!
---jjap
Back to
Seekers of Perl Wisdom