in reply to Simple regex wordlist question
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 :/#!/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();
|
|---|