16 lines
260 B
Perl
16 lines
260 B
Perl
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
my $total = total(1, 7, 5, 4, 9);
|
|
print "the total is: $total\n";
|
|
|
|
my $sum_of_100 = total(1..100);
|
|
print "the sum of 100 is: $sum_of_100\n";
|
|
|
|
sub total {
|
|
my $total = 0;
|
|
$total += $_ for @_;
|
|
$total;
|
|
}
|