aoc2015

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

day05.pl (421B) - raw


      1 #!/usr/local/bin/perl
      2 # day 2015-05
      3 
      4 use strict;
      5 use warnings;
      6 use v5.32;
      7 use lib '.';
      8 use Day05 qw( is_nice_1 is_nice_2 );
      9 
     10 @ARGV = "input" unless @ARGV;
     11 chomp( my $input = do { local $/; <> } );
     12 
     13 my @strings = split /\n/, $input;
     14 my ( $nice_1, $nice_2 ) = ( 0, 0 );
     15 
     16 foreach ( @strings ) {
     17     $nice_1++ if ( is_nice_1( $_ ) );
     18     $nice_2++ if ( is_nice_2( $_ ) );
     19 }
     20 
     21 say "part 1: ", $nice_1;
     22 say "part 2: ", $nice_2;