summary refs log tree commit diff homepage
diff options
context:
space:
mode:
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;
 }