In the course of being asked to solve
some scrambled
word puzzles, I wrote a Perl script that ran all
possible permutations and checked them against a
wordlist, but that was too slow, so I had to write
something faster.
Of course, any technology can be
turned into a japh...
After a while I'll post the original (non-JAPH)
version, which is somewhat more flexible, legible,
re-usable, and optionally verbose about its progress.
Meanwhile, amuse yourselves with this...
$d='/usr/share/dict/words';# Adjust this to point to your dictionary w
+ords file.
@a=map _ ("",split//),qw'tjsu thanore arkceh';$^X=~/n\/(....)/;splice@
+a,2,@_,$+;
sub _{my($f,@t)=@_;@c=('grep','-i','-e',"\"^$f".(join"",map".",@t).'$"
+',$d);open
_,"@c |";if(<_>){if(@t){my@l;for$i(0..$#t){my@e=@t;splice@e,$i,1;@r=_(
+"$f$t[$i]"
,@e);for$r(@r){push@l,$r}}@l}else{$f}}else{return}};s(); $\ =pop@a;;pr
+int"@a$/";
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.