foreach my $i (1..10000) { ... do stuff if (int($i/100)*100 == $i) { $mw->update(); } }