17 lines
244 B
Perl
17 lines
244 B
Perl
|
use 5.38.0;
|
||
|
|
||
|
package Part1;
|
||
|
|
||
|
use List::AllUtils qw/ sum /;
|
||
|
|
||
|
sub extract_number ($line) {
|
||
|
my @n = $line =~ /(\d)/g;
|
||
|
return join "", $n[0], $n[-1];
|
||
|
}
|
||
|
|
||
|
sub solution_1 ($input) {
|
||
|
sum map { extract_number($_) } split "\n", $input;
|
||
|
}
|
||
|
|
||
|
1;
|