[EMAIL PROTECTED] wrote:
> Hey I am new to this list and Perl in general. I was wondering which
> would be faster between a hash and an array with a large (1000000+)
> size? specifically I need to be able to add new elements and access
> the lower elements in sequential order. I'm basically finding large
> prime numbers.
>
> Max
>
Hi Max,
May I be first to say welcome to the list!
I'm not totally sure what you are trying to achieve, but I would have
thought an array would have been faster. Although if you are just
looking for prime numbers, then couldn't you achieve it with a simple
for loop and only load the primes into a hash or array?
for (my $number = 1; $num <= 1000000; $number++) {
if (prime.... etc
}#for
There is probably something on CPAN that'll help with this kind of
thing. Although a quick google has found a snippet of code that might do
exactly what you want:-
http://timjoh.com/calculate-prime-numbers-with-perl/
P.S. I think the date is off on your computer as this message is marked
10th April?
Lyle
_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm