In the perl script, I'm "forking" a parallel process. The DB connection gets messed up as a consequence (sorry, I can't articulate better because I don't fully understand). But the answer (at least what worked for me), is to formally disconnect and then reconnect back in the main thread. Fortunately, I don't have any outstanding transactions at that time so I don't lose anything as far as that's concerned.
I upgraded to 9.3.2 and recreated the DB there. So far, so good. But nights are usually the worse time, so we'll see later.
There is a more current version of the perl code, but that's not the project default at this time. If the PG upgrade fixes this, I'll be happy with that, else I'll point to the more recent perl versions.