2007/10/10, dinesh <[EMAIL PROTECTED]>: > > Issue here is: The global associative array is not getting updated in > the child process. Please suggest me how to do this.
childs and parent are separte,things changed on each process can't affect another. Say you have @global in parent,after forking,this array is private to child,changing to this array in child doesn't affect parent.The same way,changing the array in parent doesn't affect childs.(surely you can use some IPC methods like signals,socket,share memory etc,to make the thing changing happen to all processes,but this is complicated.) As a simple way,I think you can tie a global hash to a local DB_File,and use flock() to ensure the file is always changed by one process at the same time.After all childs finished,read from this DB_File and get the results. > Note that I can make use of file & file handler and push the values to > the file handler. It will work. But the problem is that the result > will not be in a sequential order (1-to-6) in the file. > Because you don't know which child at what time would change the file,so the disorder is not strange.Using a hash and fetching the values via keys is better,as I said. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/