>> "if.then.else" <[EMAIL PROTECTED]> writes:

 > > print "$windmill[$_ & 3]\r" and usleep(50) for 0..10000;
 > 
 > i'm a bit confussed with this print statement.

 0..10000 is a range from 0 to 10000.  (perlop(1), Range Operators)
 
 for (foreach) is a modifier for the statement preceding it (perlsyn(1),
 Simple statements)
 
 and is the more readable form of &&, the logical and (perlop(1),
 Logical And)

 print you know, usleep is simple a function that sleeps for so many
 microseconds

 $foo[...] is the array you already know probably.

 & is the bitwise and (perlop(1), Bitwise operators)

 $_ comes from the "for".  foreach iterates over the list and assigns
 each element to the variable you provide, or $_ if you don't provide
 any. (perlvar(1), $ARG or $_)

 foreach my $i (0..10000) {
     print "$windmill[$_ & 3]\r";
     usleep(50);
 }

 does the same.

 for($i=0; $i <= 10000; $i++) {
     print "$windmill[$_ & 3]\r";
     usleep(50);
 }

 would be the C programmer's version.

 last but not least, "$_ & 3" is the same as $_ % 4

-- 
Marcelo

Reply via email to