there is no data in @out
See the synopsis:
foreach $data (@all_data) { # Forks and returns the pid for the child: my $pid = $pm->start and next; ... do some work with $data in the child process ... $pm->finish; # Terminates the child process }
Note $data in the child process. Changes to data in the child doesn't affect the data in the parent. See the various threads about "setting environment variables from system() in perl" or such.
If you use fork, you have to return the data from the child to the parent via some IPC mechanism. But I guess you'd be better off if you use threads, pre-allocate an array with references and have each thread modify its slot in that array.
In reply to Re: Easy shared data for forked processes?
by shmem
in thread Easy shared data for forked processes?
by metaperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |