Try 

print "$windmill[$_ % 4]\r"

instead.


On 10 Jul 2001 09:04:18 -0500, Tyler Longren wrote:
> I've been playing with this spinning wheel thing.  I've read through this
> thread:
> <http://archive.develooper.com/beginners%40perl.org/msg04192.html>
> 
> I don't know why this doesn't work:
> 
> #!/usr/bin/perl -w
> use strict;
> $| = 1;
> use Time::HiRes qw(usleep);
> my @windmill=("\\", "|", "/", "-");
> for(my $i=0; $i <= 10000; $i++) {
>         print "$windmill[$_ & 3]\r";
>         usleep(50000);
> }
> 
> I get this error:
> Use of uninitialized value in bitwise and (&) at ./test.pl line 7.
> 
> Thanks everyone,
> Tyler
> 
> ----- Original Message -----
> From: "Chas Owens" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 09, 2001 4:42 PM
> Subject: Re: timer/display
> 
> 
> > On 09 Jul 2001 17:39:15 -0400, Chas Owens wrote:
> > > On 09 Jul 2001 14:03:47 -0700, [EMAIL PROTECTED] wrote:
> > > > This will sound silly.
> > > >
> > > > I need to come up with a simple status indicator of some sort. I have
> in
> > > > mind a "spinner." You've seen them before I'm sure, where there's a
> '-'
> > > > then it changes to '\' then '|' then '/' then '-' and so forth, so
> that it
> > > > appears to be spinning. Actually, I really don't care what the status
> > > > indicator looks like, I just want it to be easy to code and move in
> such a
> > > > way that long-time Windows users will understand that the computer is
> > > > working and has not hung. My solution so far is just to tuck a print
> "*"
> > > > thing in a while loop that's already present doing other work. This is
> > > > inelegant though, as it prints just thousands of asterisks. I was
> hoping
> > > > someone knew of a better way. Is there a module?
> > > >
> > > > (I have a DBI search tool that can handle lots of text strings matched
> > > > against a large db. It takes 2-15 minutes to run and users keep
> killing the
> > > > program because they think it's "stuck." For some reason, they never
> read
> > > > the instruction line, printed to the screen, that says "This may take
> up to
> > > > 15 minutes.")
> > > >
> > > > Thanks,
> > > > John
> > > >
> > > >
> > >
> > > my @windmill = ("\\", "|", "/", "-");
> > >
> > > .
> > > .
> > > .
> > > my $i = 0;
> > > print "$windmill[3 & $i]\r";
> > > while (this) {
> > > .
> > > .
> > > .
> > > $i++;
> > > print "$windmill[3 & $i]\r";
> > > }
> > >
> > > --
> > > Today is Setting Orange, the 44th day of Confusion in the YOLD 3167
> > > Hail Eris, Hack Linux!
> > >
> > >
> > >
> >
> > Oops, leave off the first \r and change the second print to read
> >
> > print "\r$windmill[3 & $i]";
> >
> > I need more caffine.
> >
> > --
> > Today is Setting Orange, the 44th day of Confusion in the YOLD 3167
> > Pzat!
> >
> 
> 
--
Today is Sweetmorn, the 45th day of Confusion in the YOLD 3167



Reply via email to