in reply to Re^4: Primes. Again.
in thread Primes. Again.

length returns the length (number of characters) in a string. Because you were setting the string to empty I used length to test for that condition and skip the empty string.

Others have provided better solutions. I was more interested in keeping to the essential structure of your code and using that as a springboard for teaching a little Perl. I seem to have achieved that. :)


DWIM is Perl's answer to Gödel