aboutsummaryrefslogtreecommitdiff
path: root/challenge-094
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2021-01-09 21:31:35 +0100
committerAbigail <abigail@abigail.be>2021-01-09 21:57:52 +0100
commit67a06243a81dbc68d16ef92db92488d783b49522 (patch)
treef6c16b09cf28d80a4ce7aea2ff262f20f9ee2974 /challenge-094
parentbaead4f7da7e805466f6961bf24531f0190e7fbe (diff)
downloadperlweeklychallenge-club-67a06243a81dbc68d16ef92db92488d783b49522.tar.gz
perlweeklychallenge-club-67a06243a81dbc68d16ef92db92488d783b49522.tar.bz2
perlweeklychallenge-club-67a06243a81dbc68d16ef92db92488d783b49522.zip
Add some notes.
But in a disclaimer you may get unexpected results if the input contains accented letters and/or combining characters. We're blaming the specification. (Or lack thereof).
Diffstat (limited to 'challenge-094')
-rw-r--r--challenge-094/abigail/perl/ch-1.pl4
1 files changed, 4 insertions, 0 deletions
diff --git a/challenge-094/abigail/perl/ch-1.pl b/challenge-094/abigail/perl/ch-1.pl
index bccd80afaa..c2fd0ddf8a 100644
--- a/challenge-094/abigail/perl/ch-1.pl
+++ b/challenge-094/abigail/perl/ch-1.pl
@@ -19,6 +19,10 @@ while (<>) {
foreach my $word (/"([^"]+)"/g) {
#
# Normalize each word: split into characters, sort them, join them.
+ # Note that we're splitting on characters, not graphemes, nor
+ # do we normalize the input. This may lead to unexpected results
+ # when using accented letters and/or combining characters. But
+ # that's what you get when using poor specifications.
#
my $normalized = join "" => sort split // => $word;
push @{$anagrams {$normalized}} => $word;