On Tue, Mar 14, 2006 at 08:57:03AM +0000, Saurabh Singhvi wrote:

>    my $child = fork ();
> 
>    unless ($child) {
>        sleep 5;
>        print "child\n";
>    }
> 
>    print "parent\n" if $child;
>    print "parent2\n" if $child;
> 
> 
> the above code prints the parent lines followed by the child. Now what
> i want to do is print the parent line1 and then the child followed by
> the parent2 line. So what changes do i need to do??

Your processes need to communicate.

Fortunately there is an entire manpage devoted to this subject:

  perldoc perlipc

You might find the section on "Bidirectional Communication with
Yourself" useful.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to