Sorry, forgot to mention that \r does not work, or I use it incorrectly. Example:
foreach $n (1..10) {
print "\r";
print "$n";
sleep 1;
}
When run nothing happens for 9 seconds and then 10 is printed, but nothing else.
| [reply] [d/l] |
When run nothing happens for 9 seconds and then 10 is printed, but nothing else
You need to turn off output buffering; in its simplest form,
adding
$|=1
should do the trick.
Dave.
| [reply] [d/l] |
"10 is printed but nothing else" should have given you the clue that "\r", was, in fact, doing *something* to the other characters. Beyond that, it depends on the console, some consoles delete the entire line and some just return the cursor to the front of the line, so you might need to pad your output with spaces if line you print currently is smaller then the line you printed before.
| [reply] |