in reply to Fast wordlist lookup for game

...for a list of that size, you could probably read the words into a hash at startup time and then the hash access would take care of the lookup for you without the need to supply significant program logic on your part.

The reason I say this is that I just looked at the size of /usr/dict/words on a Solaris system and it's about 25000 words in length. It weighs in at around 200000 bytes. This says to me that your hash would be a reasonable size.

I ran a little test that went like this from the command-line:

$ perl -de 0 DB<1> open F, "/usr/dict/words" DB<2> @f = <F> - there was a momentary delay - DB<3> print @f + 0 - debugger printed: 25143 -

I'll see if I can scrap together a little script that does the lookup. Back in a bit.

...All the world looks like -well- all the world, when your hammer is Perl.
---v