my $count; $count += $bits_in{ substr $bits, $_, 1 } for 0 .. length( $bits ) - 1;