So are mine! Your title made me laugh, thanks. Anyway consider this code:

my $pid = fork; die "Can't fork!" unless defined $pid; &do_parent_stuff if $pid != 0; &do_kids_stuff if $pid == 0; exit;

This is the essence of forking. The command fork creates two *almost* identical copies of the executing program. Both parent and child share everyting except the fork returns the systems process identifier (for the new child process) to the parent and 0 to the child. It returns undef if it fails. Thus by assigning the return value of fork to $pid our program can tell who it is - parent or child and behave accordingly.

Normally you would use an if/else structure and not botther with the == or != . They are the being gentle bit!

Hope this helps. There is heaps of info on fork on the site. Use super search with fork in the name and content fields

tachyon

s&&rsenoyhcatreve&&&s&n\w+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: my children are driving me crazy by tachyon
in thread my children are driving me crazy by blkstrat

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.