in reply to The Long Way 'Round...

My final pass has me separating each MySQL query into a separate perl process spawned by system(). (Yes, I could have fork()ed, but this is easier and more maintainable.)

It might be easier (if you don't grok fork()) but I doubt it's more maintainable. With system() you have to keep track of the path to the programs to run in sub-processes. With fork() everything stays in one script and you don't need to track a dependency.

Krang uses fork() to deal with a similar problem - memory usage in large publishing jobs. It's definitely a technique that every *nix hacker should have in his toolbox.

-sam