http://qs321.pair.com?node_id=199316


in reply to Re: Time until event
in thread Time until event

  "I wonder if printing out backspaces isn't the most efficient way to erase the line."

Actually, "\r" serves that purpose, unless you are overprinting in mid-line.   But even then, simply reprinting the unchanging beginning of the line still seems simplest.
eg,
printf(" %3d %s\r", $time, $line); while(--$time) { sleep 1; printf(" %3d\r", $time); } print"\n";
See this whirligig for a similar function.

  p