sub count_up { $mw->update; my $progress = 0; warn "after \$progress init($counter):\n"; Dump($progress); $pb->configure( -from => 0, -to => 20, -variable => \$progress, ## store the reference. ); my $cnt = 0; print "\$cnt=$cnt; \$progress=$progress\n"; for (1) { $progress++; warn "\$progreess in for() loop($counter):\n"; Dump($progress); $cnt++ unless ($_ % 2); $mw->update; } $counter++; $mw->update; }