bairdbe has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use 5.010; running_sum( 5, 6 ); running_sum( 1..6 ); running_sum( 4 ); sub running_sum { state $sum = 0; state @numbers; foreach my $number ( @_ ) { push @numbers, $number; $sum += $number; } say "The sum of (@numbers) is $sum"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: why does removing "use 5.010;" break this?
by 1nickt (Canon) on Oct 29, 2017 at 03:56 UTC | |
|
Re: why does removing "use 5.010;" break this?
by haukex (Archbishop) on Oct 29, 2017 at 06:45 UTC | |
|
Re: why does removing "use 5.010;" break this?
by ikegami (Patriarch) on Oct 29, 2017 at 18:10 UTC |