Post Reply
Posts: 6
Joined: Sun Nov 07, 2010 8:45 pm


Post by Sairera »

I am trying to do this challenge in Perl, because I am taking a Perl class and it just makes sense for me to try it in this language, so here's what I've got:
use warnings;

@numbers = (9,3,7,5,2,,,,7,4,6,,2,7,,1,7,5,4,,,9,0,,9,3,,,,,,2,3,8,,4,4,,7,5,,,0,8,7,5,0,9,1,2,7,3,8,,8,4,6,1,,8,7,5,9,3,8,3,,,3,2,8,,4,,4,9,3,5,9,0,3,,6,,5,5,5,0,3,6,0,5,3,5,0,0,4,,0,,,9,4,5,9,5,8,9,6,1,2,9,6,,2,6,7,,8,8,4,2,,,,5,,6,,,6,1,,4,,4,8,4,8,2,,8,0,,,,8,3,3,1,6,8,4,3,,7,,4,,8,3,,9,5,2,1,7,3,1,,,,2,5,,5,1,,,4,5,7,,6,,5,,9,6,9,8,2,2,2,,7,7,1,2,3,7,7,4,5,0,3,4,,5,1,3,3,5,9,2,,2,7,,,8,,8,7,,,3,5,2,2,1,,3,6,,0,,5,0,,2,3,,7,,6,3,,9,9,8,4,1,8,,);
my $sum = 0;
for (@numbers) {
$sum += $_;
print "$sum\n";

I took out the x's so I could make sure the adding works, and it did. What I need to know now is how to deal with the x's. Can anyone help?
Post Reply