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
|