Charles Lu wrote:
> foreach(1..10){
>   print "$_";
>   sleep(1);    #delay so i can see the change
>   print "\r";
> }
> 
> This code works only for increasing numbers, but when
> I try to go from 2-digit to 1 digit i.e. (11,10,9)the
> final output would be "90".  It appears that only the

Instead of printing just a "9" print either " 9" or "9 " (which ever
looks best to you).  The extra space would overwrite the other
digit of the 2 digit string leaving just the single nine on the 
screen.  If you were counting down from an arbitrarily high number
you could pack spaces to pad the shorter numbers to be the same (fixed)
width as the largest (first) number printed.  Alternatively, there are 
some fairly standard routines for clearing a line on a screen.  I am
not sure how well they work on Windows/NT shells, but they should do.

dowen
-- 
David Owen     Midsomer Consultants Inc.      [EMAIL PROTECTED]
Maintainer of the Sybase FAQ: http://www.isug.com/Sybase_FAQ
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to