Hi!
I'm writing a program that will handle huge textfiles and in order to see
the progress I wrote this bit of code that prints the procentage of the file that
has been delt with and on witch line in the text the program is on.
But it's not working out the way I was expecting.
It works fine on small
text-files, but when I run it on files that are 2-3 Gb the procentage-counter
counts from -0% to aprox. -115% and then stops while the part that prints the line the
program is on keeps running...
Anyone got any ideas?
This might have been up to discussion earlier, if so please point me in the right
direction.
Regards k2
-------------------
$fs = (-s "@ARGV" );
$rowcount=0;
while () {
Run whatever loop you want...
if ($rowcount % 1000 == 0 ) {
print "\r", int((tell INDATA) /$fs*100), "% done = $rowcount r
+ows ";}
$rowcount++;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.