]> www.fi.muni.cz Git - aoc2020.git/commitdiff
12.pl ocesane o debugovaci bastly
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 6 Dec 2020 10:44:16 +0000 (11:44 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 6 Dec 2020 10:44:16 +0000 (11:44 +0100)
12.pl

diff --git a/12.pl b/12.pl
index c24e26c57ca3ecd699290cb450f14d0747a97b10..c8b97b9fb2ddbb507e61152e5eafe1f55655896b 100755 (executable)
--- a/12.pl
+++ b/12.pl
@@ -1,7 +1,6 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Data::Dumper;
 
 local $/ = "\n\n";
 
@@ -10,12 +9,11 @@ my $sum = 0;
 while (<>) {
        my $nper = 0;
        my %q;
-       for my $per (split /\n/) {
+       for (split /\n/) {
                $nper++;
-               $q{$_}++ for grep { /\S/ } split(//, $per);
+               $q{$_}++ for split //;
        }
-       my $count = grep { $q{$_} == $nper } keys %q;
-       $sum += $count;
+       $sum += grep { $q{$_} == $nper } keys %q;
 }
 
 print "$sum\n";