aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-266/matthias-muth/perl/ch-1.pl5
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-266/matthias-muth/perl/ch-1.pl b/challenge-266/matthias-muth/perl/ch-1.pl
index a5031ee602..3272df450a 100755
--- a/challenge-266/matthias-muth/perl/ch-1.pl
+++ b/challenge-266/matthias-muth/perl/ch-1.pl
@@ -11,10 +11,11 @@
use v5.36;
sub uncommon_words( $line1, $line2 ) {
+ my @all_words = "$line1 $line2" =~ /(\w+)/g;
my %word_counts;
++$word_counts{$_}
- for "$line1 $line2" =~ /(\w+)/ig;
- my @results = grep $word_counts{$_} == 1, "$line1 $line2" =~ /(\w+)/ig;
+ for @all_words;
+ my @results = grep $word_counts{$_} == 1, @all_words;
return @results ? @results : "";
}