]> www.fi.muni.cz Git - aoc.git/blob - 2020/35.pl
Day 25: examining the input
[aoc.git] / 2020 / 35.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 my $sum = 0;
6 while (<>) {
7         chomp;
8         1 while
9                 s/\((\d+)\)/$1/ ||
10                 s/(\d+)\s*([\+\*])\s*(\d+)/"$1$2$3"/ee;
11         $sum += $_;
12 }
13 print "sum=$sum\n";