$| = 1; # flush stdout for (0 .. 23) { printf "%3d\r", $_; sleep 1; } print "\n";