|Do you know where your variables are?|
further subdivision of unpack resultby jjap (Monk)
|on Apr 13, 2011 at 02:54 UTC||Need Help??|
jjap has asked for the
wisdom of the Perl Monks concerning the following question:
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, "" ;
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!