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'