zombie processes and hung process termination

Is there a way I can run a command that will run in the kernel or in the memory and automatically kill certain scripts if they get to <defunct> processes, without having to be monitoring the server manually?

I have a Perl script which runs for 20k members and normally does not have any problems, but today, like 8 times I seen an overload of processes that just seemed to 'hang' there with the same pid number and script name, and a few of them had <defunct> running there.
I have heard of something called a kill daemon, but don't know where to find details on how to program it.

Here is an example of what I seen:
Pid Owner Priority Cpu % Mem % Command
4613 username 0 29.0 1.0 perl -w web.cgi
4614 username 0 17.0 0.2 perl -w index.cgi
4616 username 0 27.0 0.0 [web.cgi] <defunct>
15519 username 0 0.1 0.0 perl -w web.cgi
15520 username 0 0.1 0.0 perl -w web.cgi
15521 username 0 0.1 0.0 perl -w web.cgi
15523 username 0 0.1 0.0 perl -w web.cgi
15535 username 0 0.1 0.0 perl -w web.cgi
15559 username 0 0.1 0.0 perl -w web.cgi

among other things
when that happened, the script web.cgi did not load, when it did, it took like 10 minutes to load! Crazy...
Normally we have no problems, so I ran a trace on a few of the pid processes.
I cannot tell what was causing the overload.
right now there appear to be 39 people on the website and no problems the processes are popping in and out as they should...

Anyhow I would appreciate any advice anyone can offer.

Thank you much,
Richard

check this

in short, try to kill their parent process and if you can't, other option is to restart the web server

No idea if this was solved...

ps-ef | grep defun

this should do the trick..