My program (which happens to be in Perl, although I donโt think this question is specific to Perl) displays status messages at one point in a program of the form Progress: x/yy , where x and yy are a number, for example: Progress: 4/38 .
I want to โoverwriteโ the previous output when a new status message is printed, so I do not fill the screen with status messages. So far I have tried this:
my $progressString = "Progress\t$counter / " . $total . "\n"; print $progressString;
The backspace character will not be printed if I include a new line in $progressString . However, if I do not use a new line, the output buffer is never flushed and nothing is printed.
What is a good solution for this?
perl backspace output-formatting
yavoh Feb 15 '11 at 20:41 2011-02-15 20:41
source share