Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
There's more than one way to do things
 
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);


Comment on Re: Progress Bar
Download Code

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: (9)
As of 2014-04-17 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (439 votes), past polls