I was wondering if there is a way to do the 0/1 counts directly on the packed version
Yes, unpack can do that:
$ perl -le' my $string = q/01010110111000/; print $string =~ tr/1//; my $packed_string = pack q/b*/, $string; print unpack q/%32b*/, $packed_string; ' 7 7
In reply to Re: Bitwise operators on binary objects
by jwkrahn
in thread Bitwise operators on binary objects
by albert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |