in reply to Fork multi processes

Use Parallel::ForkManager. There's an example here. I see that in a reply you said you wanted to do it without using any non-core modules. That's stupid. But if you want to perpetrate stupidity (perhaps because your boss is an arse-hat) then I suggest that you take Parallel::ForkManager and simply put a copy of it in your code.