Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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

by roboticus (Chancellor)
on Feb 16, 2015 at 16:43 UTC ( [id://1116896]=note: print w/replies, xml ) Need Help??


in reply to Re^2: pack() v unpack() padding: bug or ???
in thread pack() v unpack() padding: bug or ???

BrowserUk:

Since it specifies ASCIZ, I'd expect it to work like it does. Isn't 'a2' the behaviour you're asking for?

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re^3: pack() v unpack() padding: bug or ???

Replies are listed 'Best First'.
Re^4: pack() v unpack() padding: bug or ???
by BrowserUk (Patriarch) on Feb 16, 2015 at 17:06 UTC
    Isn't 'a2' the behaviour you're asking for?

    It depends whether you mean the behaviour I'm looking for in the OP; or the behaviour I expect from Z; but actually, the answer is no in both cases.

    It's not a substitute for (my expected behaviour of) Z because it doesn't "null terminate", it only "null pads":

    C:\test>p1 print unpack 'C*', pack 'a2', $_ for qw[ fr x ];; 102 114 120 0

    And my OP question relates to unpack rather than pack. Athanasius picked up on a comment in a code sample that was more of a reminder to myself rather than a part of the OP.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-25 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found