Here's a "traditional" sort of counter, with a '.' for every percentage point and numbers at every 10% mark:
#!/usr/bin/perl -w use strict; $|++; open Fh, "file" or die "file: $!\n"; my $s = -s Fh; my ($last, $total) = 0; while (<Fh>){ $total += length; my $p = int($total * 100 / $s); if ($p != $last){ $last = $p; print STDERR $p % 10 ? "." : "$p%"; } }
-- Human history becomes more and more a race between education and catastrophe. -- HG Wells
In reply to Re: percentage while loop
by oko1
in thread percentage while loop
by marto9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |