in reply to Re: Forking sub inside a module
in thread Forking sub inside a module

Oh, that isn't so hard! I was thinking the forked process would start over at the beginning.

I am not clear on the last line. I understand that I will want to wait for the last child to finish before exiting the parent, but is there a less obfuscated way of saying that?

Replies are listed 'Best First'.
Re^3: Forking sub inside a module
by ikegami (Patriarch) on Jun 15, 2009 at 18:00 UTC
    There's nothing obfuscated there. Perhaps the 1 in void context is confusing you? It can be avoided as follows:
    while (-1 != wait) {}
      Maybe it's just me, but I find
      while (wait != -1) {}
      more natural than
      while (-1 != wait) {}
      since 'wait' is what I want to check :o)

      -- Time flies when you don't know what you're doing
        It helps to debug typo mistakes (language independent). If you was doing a regular compare '==' but used '=' instead, then 'wait = -1' will assign -1 to wait which could cause run time problems later on. However, if you do '-1 = wait' the compiler will throw a syntax error because you are trying change a constant.