programming-examples/perl/Subroutine/Passing a range of value to a subroutine.pl
2019-11-15 12:59:38 +01:00

12 lines
178 B
Perl

#!/usr/bin/perl -w
use strict;
total(1, 7, 5, 4, 9);
total(1...10);
sub total {
my $total = 0;
$total += $_ foreach @_;
print "The total is $total\n";
}