jjap has asked for the wisdom of the Perl Monks concerning the following question:
Having settled this issue of unpacking the "records" part of a binary file, I now tackle its "header" (or part of its header).
($name, $onebyte, @twobytes, @fourbytes, $back2onebyte, @trailing) = unpack( "Z16 C1 C2 C4 C1 x400 C*", $data );
The @twobytes array swallows all remaining bytes of the file, not just the 2 is am seeking. The next variables remain of course undefined. Any hints on why that happens?
For a secondary question (once I can solve the first issue), I'll mention I have over 50 variables of varying size in that header. Am I on a valid approach by appending them in the above statement? That will end up being one looong statement...Again I am very thankful for any hints as well as for your indulgence in case I am missing the obvious
Update
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unpack - array takes too many bytes
by BrowserUk (Patriarch) on Apr 15, 2011 at 05:00 UTC | |
|
Re: unpack - array takes too many bytes
by Eliya (Vicar) on Apr 15, 2011 at 04:29 UTC | |
by jjap (Monk) on Apr 15, 2011 at 04:58 UTC | |
by Eliya (Vicar) on Apr 15, 2011 at 05:36 UTC | |
by jwkrahn (Abbot) on Apr 15, 2011 at 06:11 UTC | |
|
Re: unpack - array takes too many bytes
by ikegami (Patriarch) on Apr 15, 2011 at 16:12 UTC | |
|
Re: unpack - array takes too many bytes
by BrowserUk (Patriarch) on Apr 15, 2011 at 13:05 UTC |