in reply to Controlling number of processes Forked

Hi

Though I have not given the solution, I can tell you the problem causing part in your code.

$num_processes = `ps -ef | grep $process_name | grep -v grep | wc -l +`;
The above line is the culprit there. because eventhough you controll the fork processes which are created by 'fork' you have uncontroll on 'ps'. Because that creates one more process in it. you should handle it.

Update:
It is always better to give fullpath when you specify the filename.
my $STOP_FILE = 'stopfile';
my $STOP_FILE = '/home/user/stopfile'; OR Environment variable should be :- STOP_FILE_PATH='/home/user'; my $STOP_FILE = "$ENV{STOP_FILE_PATH}/stopfile";

"Keep pouring your ideas"