diff options
author | Leah Neukirchen <leah@vuxu.org> | 2019-12-02 16:18:01 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2019-12-02 16:18:01 +0100 |
commit | 95e458366fac25a992307d4acc396d143345c102 (patch) | |
tree | 1b4e8b4acd3494c7dd13de2d9ed291f1fd913995 /day01.pl | |
parent | 5c8645076e289f3f49574b8f2fa01e42f11c6f5d (diff) | |
download | adventofcode2019-95e458366fac25a992307d4acc396d143345c102.tar.gz adventofcode2019-95e458366fac25a992307d4acc396d143345c102.tar.xz adventofcode2019-95e458366fac25a992307d4acc396d143345c102.zip |
day01
Diffstat (limited to 'day01.pl')
-rw-r--r-- | day01.pl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/day01.pl b/day01.pl new file mode 100644 index 0000000..d81b7fa --- /dev/null +++ b/day01.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w +use v5.16; + +use File::Slurper 'read_lines'; +use List::Util 'sum'; +use integer; + +my @d = read_lines "day01"; + +say sum map { $_/3-2 } @d; + +my $p2 = 0; +map { $p2 += $_ while ($_ = $_/3-2) > 0} @d; +say $p2; |