open FIN, "dwtest.dat" or die; my $bytes = do { local $/; <FIN> }; # slurrrrrp my $bits = unpack "B*", $bytes; my $count = $bits =~ tr/1/1/; print "$count\n";
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to Re: counting set bits in binary file
by merlyn
in thread counting set bits in binary file
by dwhite20899
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |