in reply to multithreading sample needed
Definitely also look at existing CPAN modules, such as Parallel::ForkManager. There are many modules out there which are designed to address the rudiments of putting together a multi-threaded application. Whether you actually use the modules in question, they are also a great resource as an example of complete and running code.