At 02:45 PM 6/15/01 +0530, George S Pereira wrote:
>Hi All,
> I have a question to ask u'all..
>
> If I print something on screen, How Do I go put the cursor back to
>where I printed and change what I printed to something else.
>
> I'll illustrate further.
>
> I wanted to create the spinning wheel with ('\','/','-' and '|')
>but I don't know how to change the character after printing it on screen.
>
> I can create a array with these characters and print it out in a
>loop, but it will just print on STDOUT, one-after-the-other.
>
> Hope u can help..
This question was answered on this list earlier today, but needs a bit of a
delay, and make sure stdout is unbuffered:
$| = 1;
use Time::HiRes qw(usleep);
my @windmill=("\\", "|", "/", "-");
print "$windmill[$_ & 3]\r" and usleep(50) for 0..10000;
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com