This seems to give the answer you want. I believe you only want to increment the count if one of the 2-bit values is '00', not count every '00'.
$ perl -le ' -> $count = 0; -> for ( 0 .. 127 ) -> { -> ( $d, $c, $b, $a ) = -> map 0 + $_, sprintf( q{%08b}, $_ ) =~ m{(..)(..)(..)(..)}; -> $count ++ unless $a and $b and $c and $d; -> } -> print $count;' 101 $
I hope this is useful.
Cheers,
JohnGG
In reply to Re: binary string
by johngg
in thread binary string
by alih110
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |