in reply to fork : distinguish between different child?
keszler (Deacon) on Oct 24, 2011 at 23:49 UTC, your reply worked perfectly! Thanks a lot - this is exactly what I wanted! PS. there's a little typo in the line print "I am child $$. \@kids count = $#kids. my dir is $dirs[$#kid+s+1]\n"; where the last bit should read [$#kids+1] (sorry I am not being anal here, but just for people who might just copy paste this code, which I sometimes do when I search forums).
ikegami (Pope) on Oct 24, 2011 at 23:56 UTC, thanks for the 'use' tips; I am new to perl so this helps. But, Deacon's method is not in series, it is in fact in parallel - I just checked by putting a sleep inside childs and also printing the localtime(time) out to the second. So in fact it is launching all childs at the same time.
JavaFan (Abbot) on Oct 25, 2011 at 00:43 UTC, no I didn't know this, but Deacon's code enlightened me on this.
ikegami (Pope) on Oct 25, 2011 at 04:45 UTC, the array element is given by [$#childs+1] as Deacon showed.
Thanks again Monks! (again I didn't mean to unnecessarily lengthen this comment thread by addressing every point, I just thought it would be helpful for people searching the forum)
|
|---|