in reply to Term::ProgressBar won't update

In the docs example, it is implicitly looping over $_ in the line for (0 .. $max). In your case you are using $i (which is probably a good thing), so you should use that instead: $next_update = $progress->update($i) if $i >= $next_update.

Replies are listed 'Best First'.
Re^2: Term::ProgressBar won't update
by cormanaz (Deacon) on Sep 17, 2022 at 22:08 UTC
    Yes that did it. I still don't for the life of me see where $_ is getting updated in the sample code. Isn't $i the index in the sample? Maybe it's some Perl voodoo/arcana I don't understand.
      I ... don't ... see where $_ is getting updated in the sample code.

      In a Perl-style for-loop like
          for (0 .. $max) { ... }
      the scalar variable $_ is the implicit loop or "topicalized" variable. (Update: See Foreach Loops in perlsyn.)


      Give a man a fish:  <%-{-{-{-<