X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=eg%2Fsimple_use.pl;fp=eg%2Fsimple_use.pl;h=6d5774786bb11306acf6c0181605b3742e72cb74;hb=33e231ca939cbe1231c82a60d2ba7f8461b659e3;hp=0000000000000000000000000000000000000000;hpb=9ba26e4bf76c371d7b7ab153c676510831816e2e;p=term-progressbar.git diff --git a/eg/simple_use.pl b/eg/simple_use.pl new file mode 100644 index 0000000..6d57747 --- /dev/null +++ b/eg/simple_use.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Term::ProgressBar 2.00; + +use constant MAX => 100_000; + +my $progress = Term::ProgressBar->new(MAX); + +for (0..MAX) { + my $is_power = 0; + for(my $i = 0; 2**$i <= $_; $i++) { + $is_power = 1 + if 2**$i == $_; + } + + if ( $is_power ) { + $progress->update($_); + } +}