The problem you are coming across isn't Perl, it's your algorithm. Learning algorithms is great -- and there have been recent discussions on algorithms for Primes (use Super Search to look for "Prime") -- but is that what you want to spend your time on right now?

Given your stated goal of learning about Perl and how to make modules, I'd just go down that path with your current algorithm, and just not test or debug it on large prime_candidates to avoid long times.

If you still want to focus on the algorithm, great; here are a few brief comments on your algorithm:

(Before posting, I see ++choroba beat me to most of those algorithm points. I said some things differently, so I am still posting this.)

In reply to Re: Stupidest Prime Number detector ever!! by pryrt
in thread Stupidest Prime Number detector ever!! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":