my $buf; my @out = (); while ( length( $bigstring )) { $buf = ''; $buf = $buf . chop $bigstring for (0..2); for (0..3) { push @out, ($buf & 64); # update: Perl didn't accept this bit +op $buf >>= 6; # but is happy with this one } }
update: Grr if only all perl bitwise operators worked on strings! Pity - it would be pointless fixing this by unpacking the "offending" byte because I was deliberately trying to avoid any unpacking in this attempt at a quickie solution.
One world, one people
In reply to Re: unpacking 6-bit values
by anonymized user 468275
in thread unpacking 6-bit values
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |