From 6ceae73940d844978fb7bea4a276fc81db29bc18 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 6 Dec 2021 10:51:52 -0500 Subject: Use postfix for more --- 2021/day06.pl | 8 ++------ 1 file 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; } -- cgit 1.4.1