adventofcode/2023/01/Part1.pm
2023-12-01 12:04:34 -05:00

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;