aoc2015

Advent of Code 2015 solutions in Perl.
git clone git://git.samirparikh.com/aoc2015
Log | Files | Refs | README

day07.pl (422B) - raw


      1 #!/usr/local/bin/perl
      2 # day 2015-07
      3 
      4 use strict;
      5 use warnings;
      6 use v5.32;
      7 use lib '.';
      8 use Day07 qw< evaluate >;
      9 
     10 @ARGV = "input" unless @ARGV;
     11 chomp( my $input = do { local $/; <> } );
     12 
     13 my %circuit;
     14 my @instructions = split /\n/, $input;
     15 
     16 foreach ( @instructions ) {
     17     /(.*) -> (.*)/; # first match is $1; second match is $2
     18     $circuit{ $2 } = $1;
     19 }
     20 
     21 my $signal = evaluate( \%circuit, 'a' );
     22 say "part 1: ", $signal;