in reply to Reporting "percent done" while processing a large file
For large files this slows things down considerably. You may want to try:open(F, "/usr/dict/words") || warn; # File to process $s=-s F; $|=1; while(<F>) { # Binary read() or readline()...whatever. # Do something with the data I presume... printf "\rComplete %.2f", 100*tell(F)/$s; }
Or something like it so there's not quite so much output.printf("\rComplete: %.2f", 100*tell(F)/$s) unless $i++ % 10;
|
|---|