commit a276c90085152cc5169f8625ea97bf5ebb29c832
parent 7a976d845a8737b985b72938968770ae789f2118
Author: Samir Parikh <noreply@samirparikh.com>
Date: Sun, 6 Nov 2022 12:06:26 +0000
start part 1 of day14
Diffstat:
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/day14/day14.pl b/day14/day14.pl
@@ -0,0 +1,26 @@
+#!/usr/local/bin/perl
+# day 2015-14
+
+use strict;
+use warnings;
+use v5.32;
+use lib '.';
+#use Day13 qw( calc_tot_hap_chg );
+use Data::Dumper;
+
+@ARGV = "input" unless @ARGV;
+chomp( my $input = do { local $/; <> } );
+my %reindeer;
+
+foreach ( split /\n/, $input ) {
+ my ( $reindeer, $speed, $fly_duration, $rest_duration ) =
+ m/(\w+) can fly (\d+) km\/s for (\d+) seconds, but then must rest for (\d+) seconds./;
+ say "$reindeer\t$speed\t$fly_duration\t$rest_duration";
+ $reindeer{ $reindeer }{ speed } = $speed;
+ $reindeer{ $reindeer }{ fly_duration } = $fly_duration;
+ $reindeer{ $reindeer }{ rest_duration } = $rest_duration;
+}
+
+say Dumper \%reindeer;
+#say "part 1: ";
+#say "part 2: ";