Thank you guys for all of the help in getting this fixed up. I started playing with the Math::Combinatorics method before I saw any of the other posts then my gf made me go to bed so I haven't had a chance to play with them too much :/

This is what I have right now though. Something still isn't quite right with the matching from the dict file (I changed it to match 3-6 letter words from a full dictionary instead fyi). The @permutationsX arrays do in fact hold the different permutations of 6choose(3-6) but there's some problem matching the words to those in the dictionary file.

#!/perl use strict; use warnings; use Math::Combinatorics; my $input = <STDIN>; chomp($input); my @inputarray = split('',$input); my $file = 'wordlist.txt'; open(INFO, $file); my @lines = <INFO>; close(INFO); chomp(@lines); print "\n\n\n\nGenerating Wordlist from \'$input\'...\n"; print "----------\n"; #find all 3 letter words and print out my @permutations3 = map { join "", @$_ } combine(3,@inputarray); my %dup3; @dup3{@permutations3} = (); my @tacobell3 = grep { exists $dup3{$_} } @lines; foreach (@tacobell3) { print "$_\n"; } #find all 4 letter words and print out my @permutations4 = map { join "", @$_ } combine(4,@inputarray); my %dup4; @dup4{@permutations4} = (); my @tacobell4 = grep { exists $dup4{$_} } @lines; foreach (@tacobell4) { print "$_\n"; } #find all 5 letter words and print out my @permutations5 = map { join "", @$_ } combine(5,@inputarray); my %dup5; @dup5{@permutations5} = (); my @tacobell5 = grep { exists $dup5{$_} } @lines; foreach (@tacobell5) { print "$_\n"; } #find all 6 letter words and print out my @permutations6 = map { join "", @$_ } permute(@inputarray); my %dup6; @dup6{@permutations6} = (); my @tacobell6 = grep { exists $dup6{$_} } @lines; foreach (@tacobell6) { print "$_\n"; } print "----------\n\n\n"; $_ = <STDIN>; exit();
The point Goib brought up is correct. Given the letters tuegps, I would want to output 'getups' 'getup' 'guest' 'gust' 'tug' etc. The code I have is SO CLOSE! It's just having an issue matching the words :/

Thanks again for all the help!

-Alan

In reply to Re: Simple regex wordlist question by Anonymous Monk
in thread Simple regex wordlist question by escherist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.