You may want to look at
Re: multiple fork() where a lot of this is handled for you.
The idealogies for it plus some extra goodies can be found in the Net::Server module on CPAN (look in the lib/Net/Server/PreFork.pm module).
my @a=qw(random brilliant braindead); print $a[rand(@a)];