This happens because the indexer's search page is often a GET form, and the parameters of the search are therefore encoded into the URL of the search results page. And having noticed that, I decided to write a program that would go through my referer log and extract just the search strings. Especially if I'm selling ads or wanting to be famous. The referer is not necessarily supported on all browsers, and will be messed up on a bookmarked entry. Taint mode doesn't make much sense here, but I turned it on in case I decide later to make this a CGI script.
Warnings are useful, but they can occasionally get in the way.
Line 2 turns on the compiler restrictions useful for all programs greater than ten lines or so. Variables will thus need to be introduced with an appropriate my directive. This is handy because it lets me see the output nearly immediately for a large log file, rather than having to wait until program exit time for the automatic buffer flush. Of course, if you're doing anything with Perl and the web, you've probably already got this installed. Lines 8 through 53 define the data gathering loop.