Here's my entry at 113, note that all we pass is the wordlist and the key to search for:
sub num{
$k=shift;for(@_){chomp;$n=lc;$n=~y/abcdefghijklmnopqrstuvwxyz/22233344
+455566677778889999/;push@{$h{$n}},$_;$h{$k}
}
Update: I believe that I can add 5 (score:118) and get all possibilities.
sub num{
#23456789_123456789_123456789_123456789_123456789_123456789_123456789_
+123456789_123456789_123456789_123456789_12345678
$k=shift;for(@_){$n=$_;chomp;lc;y/abcdefghijklmnopqrstuvwxyz/222333444
+55566677778889/;push@{$h{$k}},$n if$k=~$_}$h{$k}
}
Update #2: Now down to 107 with
all possibilities, now returns an array instead of ref to array
sub num{
$k=shift;for(@_){chomp;lc;$n=$_;y/abcdefghijklmnopqrstuvwxyz/222333444
+55566677778889/;push@h,$n if$k=~$_}@h
}
Returns a reference to
all single words found.
ie: pass it 7825 and /usr/dict/words and it will return
pub,puck,qua,rub,sub,suck etc.. (not including single letters).
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.