Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re^2: how to unpack a C struct with length array preceding data array by johnlumby
in thread how to unpack a C struct with length array preceding data array by johnlumby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-23 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found