Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Solution: Multiply numbers

sub sum {
    my $sum = 0;
    $sum += $_ for (@_);
    return $sum;
}

sub multiply {
    return 0 if not @_;
    my $res = shift;
    $res *= $_ for (@_);
    return $res;
}

1;