in reply to How do I write a program that calculates the sum of all numbers to a number, n?
use strict; use warnings; use 5.016; my $n = $ARGV[0] or die "Give a damn! Give a number."; require List::Util; say List::Util::sum( 1 .. $n );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I write a program that calculates the sum of all numbers to a number, n?
by parv (Parson) on Feb 26, 2015 at 01:47 UTC |