Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: how to unpack a C struct with length array preceding data array

by ig (Vicar)
on May 22, 2013 at 23:32 UTC ( #1034829=note: print w/ replies, xml ) Need Help??


in reply to how to unpack a C struct with length array preceding data array

If you really want to do it in one unpack you can...

use strict; use warnings; use Data::Dumper; my @arr = unpack('(W W @0Wx/a @1W@0Wx/x/a)', "\005\006Hello World"); print Dumper(\@arr);

Which produces:

$VAR1 = [ 5, 6, 'Hello', ' World' ];

But I would never do that, except to prove that I could.


Comment on Re: how to unpack a C struct with length array preceding data array
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034829]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-12-22 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (112 votes), past polls