A few years back I coded a website called HyperDictionary. It went through several life cycles of re-writes, moving from SQL database driven perl script to Dict client mod_perl module; bugt all the incarnations did basically the same thing: fetch dictionary definitions and then turn every word in the definition into a link to the definition for that word. I did it as an experiment while learning regex and mod_perl, but it ‘escaped’ into the wild thanks to web crawlers and became quite popular. The experiment ended when I needed to make a mortgage payment and I sold the site.
Not too long ago I was playing with the preg_ functions in PHP, and I decided to try to recreate the functionality of HyperDictionary with PHP. Now, I haven’t seen the HyperDictionary code in years, as deleting my local copies was part of the sales terms. I do remember the mod_perl module being fairly long and complex, even if I don’t remember how many lines of code it was. The trial version that I wacked together in PHP is essentially four lines of code. That’s a hell of an improvement over the original, though I am sure it will grow a little once I add search capability and word-of-the-day tracking. Still, the right tool can make a hell of a difference: