Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Progress Bar

by ikegami (Pope)
on Oct 06, 2004 at 02:36 UTC ( #396847=note: print w/ replies, xml ) Need Help??


in reply to Progress Bar

sub flush { my $h = select($_[0]); my $a=$|; $|=1; $|=$a; select($h); } sub show_progress { my ($progress) = @_; my $stars = '*' x int($progress*10); my $percent = int($progress*100); $percent = $percent >= 100 ? 'done.' : $percent.'%'; print("\r$stars $percent"); flush(STDOUT); } show_progress(1/4); sleep(1); show_progress(2/4); sleep(1); show_progress(3/4); sleep(1); show_progress(4/4);

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2016-07-01 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (407 votes). Check out past polls.