Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Progress Bar

by ikegami (Patriarch)
on Oct 06, 2004 at 02:36 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://396847]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-19 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found