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

Re: Print / overwrite line

Thread Previous
From:
Jon Molin
Date:
January 4, 2002 02:53
Subject:
Re: Print / overwrite line
Message ID:
3C3588DB.211DECD2@resfeber.se
"John W. Krahn" wrote:
> 
> 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;

or 
printf "\r"." " x (length ($old_string) - length ($new_string));
to be sure you pad the exact length.



> 
> John
> --
> use Perl;
> program
> fulfillment
> 
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org

Thread Previous


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