Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Perl's pearls

by gmax (Abbot)
on Dec 31, 2001 at 11:41 UTC ( #135345=perlmeditation: print w/ replies, xml ) Need Help??

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
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://135345]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2015-05-29 03:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (574 votes), past polls