adventofcode/08/1.pl

17 lines
219 B
Perl
Raw Normal View History

2017-12-08 18:19:49 +00:00
use 5.20.0;
my %reg;
while(<>) {
s/^(\w+)/\$reg{$1}/;
s/(?<=if )(\w+)/\$reg{$1}/;
s/dec/-=/;
s/inc/+=/;
eval;
}
use List::UtilsBy qw/ max_by /;
use List::AllUtils qw/ max /;
say max values %reg;