CPU: Perl, Fall 2005 Perl, Week 3: More Arrays, Context, Subroutines, Lexical Variables #59

Step 2: &total

sub total {
    my (@numbers) = @_;

    my $total = 0;
    foreach my $number (@numbers) {
        $total += $number;
    }
    $total;
}
Copyright © 2005 Ian Langworth