Hi,
I'm doing one of the Project Euler exercises which asks the sum of 100
fifty-digit numbers[1]. My code is 2 parts:

I open the text file containing the digits and put into an array:
========================BEGIN_CODE=========================
open (F, "Fifty_hundred.txt") || die "Could not open Fifty_hundred.txt: $!\n";

@numbers = <F>;
close F;
========================END_CODE===========================

Next I sum the values in the array:
========================BEGIN_CODE=========================
$sum = 0;
for (@numbers) {
    $sum += $_;
}
========================END_CODE===========================

I get an answer but its wrong (according to Project Euler). Now I am
looking into the BigNum functions but I am not sure how they work and
don't really know how to use it.

Thanks



Reference:
[1] http://projecteuler.net/problem=13

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to