http://qs321.pair.com?node_id=675458


in reply to Forking problems

Here is a little example of using fork():
if(my $pid = fork){ print "I am the parent my pid is $$ and my child has pid: $pid\n"; } elsif(defined $pid and $pid == 0){ print "I am the child and my pid is $$\n"; } else{ print "Oh no :-(\n"; }
Update: Oops fixed bug pointed out by pc88mxer below.