in reply to
Re: how to unpack a C struct with length array preceding data array
in thread how to unpack a C struct with length array preceding data array
sorry for delay acknowledging your and others' posts - I mistook the first response to mine as some kind of disapproval
As to your
What is the practical advantage ...
I view the task of performing the unpacking of the string as logically one task, not two, and so perhaps it is clearer to any reader how this task is being accomplished if done in one reasonably intuitive statement rather than two. If by practical you were thinking more of performance, then none.
And I omitted to say originally that what encouraged me to believe that such a statement might exist is this from perlfunc "pack"
For "unpack", an internal stack of integer arguments unpacked so far is used. You write "/"sequence-item
and the repeat count is obtained by popping off the last element from the stack. The sequence-item must not
have a repeat count.
I was not sure what this meant but it seemed relevant.
I tried using it in various ways but all failed.
I did not find any elucidation of this in perltut
I *think* some of the suggestions offered in this thread are using such sequence-items but I'm not sure; and if so, I'm also not sure how the argument numbers are being pushed onto the stack.
If anyone can explain what the quoted text means (specifically the integer arguments) or have a simpler example, I would appreciate that.