Several resources come to mind. For example:
merlyn has written some columns on the subject. You may find this and this helpful. (This is interesting, too.)
O'Reilly's CGI Programming with Perl offers one starting place. You can find the code online, but the book is well worth the investment.
The Perlfect Search engine is quite good.
CPAN contains several modules of interest. Consider, for example, this search (alt.)
Finally, there are scads of nodes related to the subject. Consider the results of this simple search: site search engine.
To paraphrase the tag line of a certain TV show, the code is out there.
--f