* news reader <[EMAIL PROTECTED]> [2002-03-15 21:36 +0100]: > I have a perl script which is working as TCP socket server. [...] > if (($processarray[$testNo] = fork()) == 0) { > [...] > The problem that i am facing is : the same line is printed more than once
When you fork(), the child inherits its parent's unflushed output buffers. When it dies or feels like flushing, it flushes them. So does the parent process, and that's why you get duplicate output. Hint: disable perl's print buffering with $|=1; before you fork(). For more help on this, have a look at "perldoc -f fork" or "man perlipc" -- Johannes Franken Professional unix/network development mailto:[EMAIL PROTECTED] http://www.jfranken.de/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]