Help for this page

Select Code to Download


  1. or download this
    ---------------------------
        create an empty words_hash
    ...
        foreach item in words_hash
            print anagrams
    ----------------------------
    
  2. or download this
        Abby
        abbot
    ...
        later
        Unix
        UNIX
    
  3. or download this
        key      values
        -----    ---------
    ...
        best  => best bets
        inux  => unix
        aelrt => alert alter later
    
  4. or download this
        
        abby baby
        acne cane
        best bets
        alert alter later
    
  5. 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;
    
  6. or download this
     my @anagrams =();
     foreach (values %words) {
    ...
     foreach (sort @anagrams) {
            print "$_\n"
     }
    
  7. or download this
        if (exists $words{$windex}) {             
            my $word = $_;
    ...
                $words{$windex} ;    # skip duplicates
            $words{$windex} .= " ";  # add separating space
        }
    
  8. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        push @{$words{$windex}}, $word;
    }
    print map {"@$_\n"} sort grep {scalar @$_ > 1} values %words;
    
  9. 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
    
  10. or download this
    abolitionism mobilisation 
    acres cares races sacre scare
    ...
    predicts scripted
    striptease tapestries
    shower whores