diff options
128 files changed, 7846 insertions, 3037 deletions
diff --git a/challenge-306/dave-jacoby/perl/ch-1.pl b/challenge-306/dave-jacoby/perl/ch-1.pl new file mode 100644 index 0000000000..901dffcdff --- /dev/null +++ b/challenge-306/dave-jacoby/perl/ch-1.pl @@ -0,0 +1,36 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use experimental qw{ say state postderef signatures }; + +use List::Util qw{ sum0 }; + +my @examples = ( + + [ 2, 5, 3, 6, 4 ], + [ 1, 3 ], +); + +for my $example (@examples) { + my $ints = join ', ', $example->@*; + my $output = odd_sum( $example->@* ); + say <<"END"; + Input: \@ints = ($ints) + Output: $output +END +} + +sub odd_sum(@ints) { + my $output; + for my $l ( map { $_ * 2 - 1 } 1 .. $#ints ) { + next if $l > scalar @ints; + for my $i ( 0 .. $#ints ) { |
