String::BitCount - count number of "1" bits in strings
use String::BitCount; # get the number of bits in $string. my $count = BitCount($string); # prints '334'; The number of bits in the codes # of 'a', 'b' and 'c' are '3', '3' and '4'. print showBitCount('abc'), "\n";
Returns the the total number of "1" bits in the list.
Copies the elements of LIST to a new list and converts the new elements to strings of digits showing the number of set bits in the original byte. In array context returns the new list. In scalar context joins the elements of the new list into a single string and returns the string. Only code points in the range 0x00 .. 0xFF are allowed.
The original BitCount design predated the introducing of the 'b' pack template. Now you should use
$bit_count = unpack("%32b*", $string).
The arguments of showBitCount are restricted to strings of characters having code points in the range 0x00 .. 0xFF. If any string argument has code points greater than 0xFF (255) a "Wide character" warning will be issued.
Winfried Koenig <firstname.lastname@example.org>