summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-12-06 10:51:52 -0500
committerJune McEnroe <june@causal.agency>2021-12-06 10:51:52 -0500
commit6ceae73940d844978fb7bea4a276fc81db29bc18 (patch)
tree9a742e7c0e6cd098654ba365e066905f8615973f
parentSolve day 6 part 2 (diff)
downloadaoc-6ceae73940d844978fb7bea4a276fc81db29bc18.tar.gz
aoc-6ceae73940d844978fb7bea4a276fc81db29bc18.zip
Use postfix for more
Diffstat (limited to '')
-rw-r--r--2021/day06.pl8
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;
 }