in reply to Confused by fork examples
fork creates this dupicate in a child process of the one running the original perl script. The way you tell them apart is by checking the id returned from fork. If the id is 0, you are in the child process. If the id is non-zero, you are in the parent. That non-zero id is the id of the spawned child process.
so, after running fork, check the id and condition your code appropriately for the child or the parent
|
|---|