Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Controlling already printed text to console.

by flexvault (Parson)
on Aug 02, 2012 at 16:08 UTC ( #985066=note: print w/ replies, xml ) Need Help??

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

Comment on Re: Controlling already printed text to console.
Download Code
Re^2: Controlling already printed text to console.
by humble (Acolyte) on Aug 03, 2012 at 19:15 UTC
    Oh, thank You, flexvault.

    The script in question - works on Linux, but I prefer using PERL tools|solutions in my PERL scripting - I have had a lot of BASH scripting already inserted into my PERL code, so I would like rather to remove it w/ PERL code, than adding more OS tools.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985066]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-08-01 02:56 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (256 votes), past polls