diff options
| -rw-r--r-- | challenge-003/cliveholloway/README | 1 | ||||
| -rwxr-xr-x | challenge-003/cliveholloway/perl5/ch-2.pl | 23 | ||||
| -rw-r--r-- | members.json | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/challenge-003/cliveholloway/README b/challenge-003/cliveholloway/README new file mode 100644 index 0000000000..b69201296e --- /dev/null +++ b/challenge-003/cliveholloway/README @@ -0,0 +1 @@ +Solution by Clive Holloway diff --git a/challenge-003/cliveholloway/perl5/ch-2.pl b/challenge-003/cliveholloway/perl5/ch-2.pl new file mode 100755 index 0000000000..be67bd4673 --- /dev/null +++ b/challenge-003/cliveholloway/perl5/ch-2.pl @@ -0,0 +1,23 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use v5.012; + +my @out=([1],[1,1]); + +for (3..$ARGV[0]) { + my @new_row=(1,@{$out[-1]}); + for (1..$#{$out[-1]}) { + $new_row[$_] = $out[-1][$_-1] + $out[-1][$_]; + } + push @out, \@new_row; +} + +# format data for output - obviously you'll run out of terminal at some point, +# so, this is just a pretty demo output +my $longest_length = length("@{$out[-1]}"); +for (0..$#out) { + $out[$_] = "@{$out[$_]}"; + my $this_length = length($out[$_]); + say ' 'x(($longest_length-$this_length)/2).$out[$_]; +} diff --git a/members.json b/members.json index 4673a209f8..715990fb11 100644 --- a/members.json +++ b/members.json @@ -13,6 +13,7 @@ "aubrey-quarcoo" : "Aubrey Quarcoo", "bill-palmer" : "Bill Palmer", "bob-kleemann" : "Bob Kleemann", + "cliveholloway" : "Clive Holloway", "daniel-mantovani" : "Daniel Mantovani", "dave-cross" : "Dave Cross", "dave-jacoby" : "Dave Jacoby", |
