in reply to Controlling already printed text to console.
If your working on a *nix system, you could use the 'tput' command. There may be something similar in Windows but someone else will have to answer that. Use 'tput' as below (untested):
my $rows = qx/tput lines/; my $curor_up = qx/tput cuu1/; for my $no ( 0..10 ) { print "$no. Hello World!\n$curor_up"; }
I use this technique to show status of a long running script, but I use 'time' to print the status every so many seconds. I did't use '$rows', but that tells you how many lines are on the screen. So you could move the cursor to the bottom -2 and display the results at the bottom of the screen. Also 'tput' is a system commands, so try to use it outside of loops for performance reasons.
Good Luck!
"Well done is better than well said." - Benjamin Franklin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Controlling already printed text to console.
by humble (Acolyte) on Aug 03, 2012 at 19:15 UTC |