You're surely not waiting enough. You spawn 8 (not 11) child processes, and you have to wait for all of them:
1 while (wait > 0);
Let me also note that you're cluttering your @smokearr doing the cycles the way you do. When you use the cycle the first time, it terminates after $index becomes equal to 8, adding an element undef to the array, which evaluates to false. Whether this is what you really wanted is up to you, of course, but I'd feel safer using something like:
for (my $index = 0; $index < @smokearr; ++$index) { #...
This takes advantage from the fact that an array evaluated in scalar context gives you the number of elements in the array itself.

Moreover, you don't seem to use $index other than for indexing the array, in which case I'd better use the more Perlish:

foreach my $item (@smokearr) { # ... use $item instead of $smokearr[$index] ... }
which, in my opinion, improves readability (and it's less typing, too :).

Flavio (perl -e "print(scalar(reverse('ti.xittelop@oivalf')))")

Don't fool yourself.

In reply to Re: Fork Wait and probably grandchildren by polettix
in thread Fork Wait and probably grandchildren by Discordanian

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.