http://qs1969.pair.com?node_id=383847


in reply to pack/unpack 6 bit fields.

Assuming you are starting with a bit string $str and want to end up with an array of bit strings @arr, I would try:

my @arr = map { pack "b6" } unpack "A6"x16, unpack "b96", $str;

I'm not sure how best to test the efficiency of that.

Update: tye's explanation is most likely to be more accurate. I was just taking a stab.