develooper Front page | perl.beginners | Postings from January 2002

Re: Print / overwrite line

From:
John W. Krahn
Date:
January 3, 2002 17:15
Subject:
Re: Print / overwrite line
Message ID:
3C35022B.E3EA6061@acm.org
Gary Hawkins wrote:
> 
> How can I clear a line before replacing it?
> 
> Am doing \r and overwriting, but sometimes the text that was there previously
> is longer than the new text.

Pad the shorter lines with spaces.  For example:

printf "\r%-20s", $something;



John
-- 
use Perl;
program
fulfillment



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About