Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Anonymous Monk
on Feb 16, 2015 at 13:57 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found