Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

String::BitCount
count number of "1" bits in strings

String::BitCount - count number of "1" bits in strings


NAME

String::BitCount - count number of ``1'' bits in strings


SYNOPSIS


  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";


DESCRIPTION

BitCount LIST
Returns the the total number of ``1'' bits in the list.

showBitCount 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.


NOTES

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.


AUTHOR

Winfried Koenig <w.koenig@acm.org>


SEE ALSO

perl(1)

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy