in reply to Losing Bits with Pack/Unpack
Well others have already explained why what you're trying to do is a bad idea. Maybe if you told us why you're trying to do something like that we might be able to help find a better solution though.
But, for your information, one reason why this just won't work is that pack is always byte aligned. That's why (H5)* changes every third char. H is half a byte/char, so H2 reads a full one, H4 reads two, and H5 reads two and a half. But the next iteration aligns itself on the next char and simply ignores the half byte that was unread. So you're just losing data, not shifting any bits.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Losing Bits with Pack/Unpack
by o0lit3 (Friar) on Sep 17, 2020 at 11:55 UTC | |
by Eily (Monsignor) on Sep 17, 2020 at 12:42 UTC |
In Section
Seekers of Perl Wisdom