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.
(The last one is because \0 is the padding for 'a' patterns, so I wanted to be sure it wasn't removed)>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"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with pack/unpack asymmetry
by johngg (Canon) on Jun 19, 2019 at 16:31 UTC | |
by shmem (Chancellor) on Jun 21, 2019 at 11:38 UTC |