my @numb = (1..100); print sum(\@numb); sub sum { my $numb = shift; my $total; foreach (@$numb) {$total += $_}; return $total; }