adventofcode/2020/01/part1.pl

14 lines
245 B
Perl

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;
}