in reply to Re: Any caveats in using unpack to right-trim? Why isn't it advertised more?
in thread Any caveats in using unpack to right-trim? Why isn't it advertised more?

I have mixed feelings about this.

I'm a bit puzzled by it.
The "A*" format apparently removes trailing whitespace, but not embedded whitespace:
D:\>perl -wle "print '#' . unpack('A*', 'abc ') . '#';" #abc# D:\>perl -wle "print '#' . unpack('A*', 'abc d') . '#';" #abc d#
How is all of that explained as being "expected behaviour" ?
Duh - it's explicitly stated in the documentation - " When unpacking, "A" strips trailing whitespace and nulls".

Cheers,
Rob