]> www.fi.muni.cz Git - aoc.git/blob - 2020/7.pl
Day 8: Perl-ish solution with closures
[aoc.git] / 2020 / 7.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 $/ = "\n\n";
6
7 my $valid = 0;
8 while (<>) {
9         $valid++ if (
10                 grep { /^(?:byr|iyr|eyr|hgt|hcl|ecl|pid):/ }
11                 split /\s+/
12         ) == 7;
13 }
14
15 print "Valid: $valid\n";
16