Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: (Golf) mobile phone numbers - words

by the_slycer (Chaplain)
on May 29, 2001 at 20:00 UTC ( #83987=note: print w/ replies, xml ) Need Help??

in reply to (Golf) mobile phone numbers -> words

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).

Comment on Re: (Golf) mobile phone numbers - words
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://83987]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2015-11-26 12:19 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls