diff options
author | June McEnroe <june@causal.agency> | 2021-12-06 10:51:52 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-12-06 10:51:52 -0500 |
commit | 6ceae73940d844978fb7bea4a276fc81db29bc18 (patch) | |
tree | 9a742e7c0e6cd098654ba365e066905f8615973f /2021/day06.pl | |
parent | Solve day 6 part 2 (diff) | |
download | aoc-6ceae73940d844978fb7bea4a276fc81db29bc18.tar.gz aoc-6ceae73940d844978fb7bea4a276fc81db29bc18.zip |
Use postfix for more
Diffstat (limited to '2021/day06.pl')
-rw-r--r-- | 2021/day06.pl | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/2021/day06.pl b/2021/day06.pl index 3fc7ac2..6e5fa15 100644 --- a/2021/day06.pl +++ b/2021/day06.pl @@ -16,14 +16,10 @@ for (1..80) { } print scalar(@fish), "\n"; my %counts; -for (@init) { - $counts{$_}++; -} +$counts{$_}++ for @init; for (1..256) { my $zeros = $counts{0} // 0; - for (0..7) { - $counts{$_} = $counts{$_+1}; - } + $counts{$_} = $counts{$_+1} for 0..7; $counts{8} = $zeros; $counts{6} += $zeros; } |