Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 pondering the Monastery: (7)
As of 2015-07-31 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls