adventofcode/08/2.pl
Yanick Champoux 78d3e14c07 day08
2017-12-08 13:19:49 -05:00

18 lines
219 B
Perl

use 5.20.0;
use List::AllUtils qw/ max /;
my %reg;
my $max;
while(<>) {
s/^(\w+)/\$reg{$1}/;
s/(?<=if )(\w+)/\$reg{$1}/;
s/dec/-=/;
s/inc/+=/;
eval;
$max = max $max, values %reg;
}
say $max;