chanakya has asked for the wisdom of the Perl Monks concerning the following question:

Greetings eveyone !!
I have a script which will look in a pre-defined log directory, gets the file names,
processes the files one by one and removes the processed file from the log directory.
Now, I want to split the processing of log files to multiple sub-processes, as the current processing takes longer time.

What I want to do is say, when executes, the will look into the log directory and gets
the file names in the log directory. For Example if finds 3 log files, then it
will fork 3 sub-processes of and pass each of the log file as an input to the sub processes of

The will have to wait until all the sub-processes returns. Once all the sub-processes return then the parent, i.e will get newer filenames and the process continues. And also the most important part is all the three sub-processes should run at the same time and not one after another.

Can anyone tell me how to implement the forking and parent script to wait until the sub-processes return.