Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature qw(say);
- my $part1 = 0;
- foreach my $line (<>) {
- $part1 += $1 * $2 while ($line =~ m#mul\((\d{1,3}),(\d{1,3})\)#g);
- }
- say "Part 1: ", $part1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement