in reply to
A basic 'worker' threading example.
It's also worth noting, in addition to this most-excellent post, that there are a lot of Perl workflow/thread/process management packages already out there ... POE, Parallel::ForkManager, and so on and on and on. This type of threading is a FIP = Frequently Implemented Program, so look around in CPAN for "prior art" that you can readily use in your project.
Yes, you can always build a door from scratch. But you can also buy a pre-hung door or even a complete wall with doors, windows and electrical wiring, or a mobile home. Therefore, “choose wisely, because the choice is yours to make.” No matter exactly what-it-is that you are doing, you
usually always have the option to start from somewhere other than “from scratch.” (Or not.) The set of options that are available to you in CPAN are very large indeed, so “build vs. borrow” should be an engineering decision that you consider and make from the earliest possible point.
Actum Ne Agas: Do Not Do A Thing Already Done.