Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: (un)jumbler...

by Anonymous Monk
on Nov 09, 2004 at 17:53 UTC ( [id://406415]=note: print w/replies, xml ) Need Help??


in reply to (un)jumbler...

You can use Math::Combinatorics for this. Something like:
use Math::Combinatorics; for (`cat /usr/share/dict/words`) { chomp; $real_words{$_}++ } while (<STDIN>) { chomp; my @letters = split //; foreach my $word_len (1 .. @letters) { foreach my $combination (combine($word_len, @letters)) { foreach my $permutation (permute(@$combination)) { my $word = join '', @$permutation; print "$word\n" if $real_words{$word}; } } } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://406415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found