- or download this
---------------------------
create an empty words_hash
...
foreach item in words_hash
print anagrams
----------------------------
- or download this
Abby
abbot
...
later
Unix
UNIX
- or download this
key values
----- ---------
...
best => best bets
inux => unix
aelrt => alert alter later
- or download this
abby baby
acne cane
best bets
alert alter later
- or download this
#!/usr/bin/perl -w
# usage: anagram.pl < wordlist
...
$words{$windex} .= $_; # inserts a new word
}
print map {"$_\n"} sort grep {tr/ //} values %words;
- or download this
my @anagrams =();
foreach (values %words) {
...
foreach (sort @anagrams) {
print "$_\n"
}
- or download this
if (exists $words{$windex}) {
my $word = $_;
...
$words{$windex} ; # skip duplicates
$words{$windex} .= " "; # add separating space
}
- or download this
#!/usr/bin/perl -w
use strict;
...
push @{$words{$windex}}, $word;
}
print map {"@$_\n"} sort grep {scalar @$_ > 1} values %words;
- or download this
# French and Italian anagrams
my $windex = $_;
...
# unaccented vowels
tr/ÀÈÉÌÒÙ[A-Z]/àèéìòù[a-z]/; # converts to lowercase
$windex = pack "C*", sort unpack "C*", $windex; # create index
- or download this
abolitionism mobilisation
acres cares races sacre scare
...
predicts scripted
striptease tapestries
shower whores