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).
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.