Help for this page
--------------------------- create an empty words_hash ... foreach item in words_hash print anagrams ----------------------------
Abby abbot ... later Unix UNIX
key values ----- --------- ... best => best bets inux => unix aelrt => alert alter later
abby baby acne cane best bets alert alter later
#!/usr/bin/perl -w # usage: anagram.pl < wordlist ... $words{$windex} .= $_; # inserts a new word } print map {"$_\n"} sort grep {tr/ //} values %words;
my @anagrams =(); foreach (values %words) { ... foreach (sort @anagrams) { print "$_\n" }
if (exists $words{$windex}) { my $word = $_; ... $words{$windex} ; # skip duplicates $words{$windex} .= " "; # add separating space }
#!/usr/bin/perl -w use strict; ... push @{$words{$windex}}, $word; } print map {"@$_\n"} sort grep {scalar @$_ > 1} values %words;
# 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
abolitionism mobilisation acres cares races sacre scare ... predicts scripted striptease tapestries shower whores
www.com | www.net | www.org
No recent polls found