in reply to fork()ing and sharing data amongst children
For the task that you describe, threads seem more appropriate than forked processes, since with the former you can share variables in the strictest sense and with the latter you just can't.
But it may well be that depending on your actual application that forking is the way to go. In that case you can make your processes communicate and coordinate each other. This is called, not surprisingly, "interprocess communication" and you may find relevant info for Perl in perldoc perlipc
Very lightweight and cheap forms of ipc are piped opens and named pipes (or FIFOs); the latter ones assume you're on *NIX.
|
|---|