Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Can unpack add zero bytes before converting?

by tybalt89 (Monsignor)
on Sep 12, 2021 at 19:00 UTC ( [id://11136695]=note: print w/replies, xml ) Need Help??


in reply to Re: Can unpack add zero bytes before converting?
in thread Can unpack add zero bytes before converting?

Maybe unpack can't but pack can :)

try:

return unpack '(Q<)*', pack '(a8)*', unpack "(a$length)*", $stream;

And you no longer need $pad or the map.

semi-tested :)

Replies are listed 'Best First'.
Re^3: Can unpack add zero bytes before converting?
by Anonymous Monk on Sep 13, 2021 at 12:45 UTC

    See? I knew someone would come up with something cleaner. Thanks.

    I understand the OP to have requested that it be done in a single unpack, but I'm convinced that is not possible -- a challenge for someone to come along and prove me wrong. And that is how knowledge grows.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-26 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found