$| = 1; # it's important for autoflush to be on my $counter; for ( $counter = 0; $counter < 5000; $counter++ ) { # ... # check, is this the 5th object? if ( ( $counter % 5 ) == 0 ) { printf( "%5d\r", $counter ); } } # clear status print( ( " " x 5 ) . "\n" );