From 13cfd360455813f67dee7f411cf9590d444948a5 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 6 Dec 2021 10:31:29 -0500 Subject: Solve day 6 part 1 --- 2021/day06.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 2021/day06.pl (limited to '2021') diff --git a/2021/day06.pl b/2021/day06.pl new file mode 100644 index 0000000..b296a4c --- /dev/null +++ b/2021/day06.pl @@ -0,0 +1,16 @@ +use strict; +use warnings; +my @fish = split(/,/, <>); +for (1..80) { + my @spawns; + for my $f (@fish) { + if ($f) { + $f--; + } else { + $f = 6; + push @spawns, 8; + } + } + push @fish, @spawns; +} +print scalar(@fish), "\n"; -- cgit 1.4.1