my $total = 0; for (my $ctr=0; $ctr<@score; $ctr++) { $total += $score[$ctr]; # maybe use $ctr for some other purpose as well... } print "$total\n";