in reply to Re^2: Mysteries of unpack("a", ...)
in thread Mysteries of unpack("a", ...)
That's wrong.
While pack (whose documentation you quoted) will add NULs, unpack doesn't.
>perl -le"print length unpack 'a4', ''" 0
If anything, unpack should do the opposite (remove trailing NULs), but it doesn't do that either.
>perl -le"print length unpack 'a4', qq{\0\0\0\0}" 4
|
|---|