use strict; use warnings; my $total_filtered = 0; open my $cgs, "<", "count.txt"; $/ = \10000; # blocksize $total_filtered += tr/0/0/ while <$cgs>; print "Found $total_filtered zeroes.\n";