Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Moving the output cursor in Windows

by ktross (Deacon)
on May 27, 2005 at 14:37 UTC ( [id://461083]=note: print w/replies, xml ) Need Help??


in reply to Moving the output cursor in Windows

If you print "\r", it returns you to the beginning of the current line. This snippet counts to 10.
for(1..10){ print "\r", 'line: ', $_; sleep(1); }


Spem Successus Alit

Replies are listed 'Best First'.
Re^2: Moving the output cursor in Windows
by LanceDeeply (Chaplain) on May 27, 2005 at 15:34 UTC
    OP may not know how to flush the buffer immediately to see the count...
    $|=1; for(1..10){ print "\r", 'line: ', $_; sleep(1); }
Re^2: Moving the output cursor in Windows
by thundergnat (Deacon) on May 27, 2005 at 15:34 UTC

    You need to unbuffer STDOUT first for that to work correctly. With buffered output, it just waits for 10 seconds then prints "Line 10".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-25 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found