Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: How to dynamically update value in STDOUT?

by Sidhekin (Priest)
on Nov 05, 2007 at 01:44 UTC ( #648936=note: print w/replies, xml ) Need Help??

in reply to How to dynamically update value in STDOUT?

I think you are looking for a carriage return (without line feed):

sub do_stuff { sleep 2; # for the sake of the example .. } $|=1; # turn off buffering, or you may never see what you write ... my @v = (1, 3, 10, 20); while (@v) { printf "\r%2d", shift @v; do_stuff(); }

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!

Replies are listed 'Best First'.
Re^2: How to dynamically update value in STDOUT?
by bowei_99 (Friar) on Nov 05, 2007 at 03:00 UTC
    Thanks. Yes, that was it. I had tried your suggestion earlier, but forgot the '\r'. It's working now.

    -- Burvil

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://648936]
[Discipulus]: echo 'a'\'' gives me the prompt and then go with error on ctrl-d
[Discipulus]: uch! worst than windows!
[marto]: It's not worse, just different. Different shells, different tools. Different ways
[choroba]: Perl to the rescue!
[choroba]: yes, it's documented in man bash. You need to echo 'Joe'\''s home'

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2017-11-24 10:23 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (346 votes). Check out past polls.