adventofcode/2020/01/part1.pl

14 lines
245 B
Perl
Raw Normal View History

2021-12-05 16:51:21 +00:00
use 5.20.0;
use warnings;
use Path::Tiny;
my @expenses = path('input')->lines;
while(my $this = shift @expenses) {
my $that = 2020 - $this;
next unless grep { $_ == $that } @expenses;
print join " ", $this, $that, $this*$that;
}