while ($time--) { printf(" %3s %s", $time, $line); print "\b" for (1..$backcount); # or this could even be written as: # print "\b" x $backcount; sleep 1; }