Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: pack() v unpack() padding: bug or ???

by Anonymous Monk
on Feb 16, 2015 at 13:57 UTC ( #1116870=note: print w/replies, xml ) Need Help??


in reply to pack() v unpack() padding: bug or ???

This pack thing is just a pain. unpack is not the exact opposite, no.
The "a", "A", and "Z" types gobble just one value, but pack it as a string of length count, padding with nulls or spaces as needed. When unpacking, "A" strips trailing whitespace and nulls, "Z" strips everything after the first null, and "a" returns data with no stripping at all.
pack

Replies are listed 'Best First'.
Re^2: pack() v unpack() padding: bug or ??? (strip)
by tye (Sage) on Feb 16, 2015 at 19:23 UTC

    Another way to look at it is: unpack() does the opposite of pack() and the opposite of padding is stripping. (No, I'm not claiming that unpack() always does the exact opposite of pack().)

    - tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-05-17 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (68 votes). Check out past polls.

    Notices?