in reply to Newbie Question on pushing Arrays

Don't increment $number at random points in your code.
LOOP: for ($number = 3; $number < $limit; $number += 2) { ... foreach $div (@primes) { if ($number % $div == 0) { next LOOP; } } ... }

Replies are listed 'Best First'.
Re: Re: Newbie Question on pushing Arrays
by JojoLinkyBob (Scribe) on May 04, 2001 at 20:30 UTC
    Good idea, if you do this approach, make sure you add 2 to @primes in the last step, since the loop iteration automatically avoids even numbers
    Desert coder
      ... but @primes is initialized to (2) in the beginning.