Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Problem with pack/unpack asymmetry

by Eily (Monsignor)
on Jun 19, 2019 at 14:53 UTC ( [id://11101575]=note: print w/replies, xml ) Need Help??


in reply to Problem with pack/unpack asymmetry

The pack doc says:

When unpacking, A strips trailing whitespace and nulls, Z strips everything after the first null, and a returns data with no stripping at all.
Whitespace seems to be the same thing as \s in regexes.
>perl -MData::Dump=pp -E "pp unpack 'A*', qq<aaaa\t\n >" "aaaa" >perl -MData::Dump=pp -E "pp unpack 'a*', qq<aaaa\t\n >" "aaaa\t\n " >perl -MData::Dump=pp -E "pp unpack 'a*', qq<aaaa\t\n \0>" "aaaa\t\n \0"
(The last one is because \0 is the padding for 'a' patterns, so I wanted to be sure it wasn't removed)

Replies are listed 'Best First'.
Re^2: Problem with pack/unpack asymmetry
by johngg (Canon) on Jun 19, 2019 at 16:31 UTC

    A sad case of RTFM then! What's even worse, now that you've brought it to my attention I vaguely remember reading that passage some years ago :-(

    Thank you, shmem and Eily, for your replies.

    Cheers,

    JohnGG

      A sad case of RTFM then!

      See my signature ;-)

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found