]> git.donarmstrong.com Git - term-progressbar.git/blob - eg/simple_use.pl
copy two examples from the docs to the eg directory
[term-progressbar.git] / eg / simple_use.pl
1 #!/usr/bin/perl\r
2 use strict;\r
3 use warnings;\r
4 \r
5 use Term::ProgressBar 2.00;\r
6 \r
7 use constant MAX => 100_000;\r
8 \r
9 my $progress = Term::ProgressBar->new(MAX);\r
10 \r
11 for (0..MAX) {\r
12   my $is_power = 0;\r
13   for(my $i = 0; 2**$i <= $_; $i++) {\r
14     $is_power = 1\r
15       if 2**$i == $_;\r
16   }\r
17 \r
18   if ( $is_power ) {\r
19     $progress->update($_);\r
20   }\r
21 }\r