iic has asked for the wisdom of the Perl Monks concerning the following question:

It's do nothing in fact.Just is a test.
I can run it in line with my purpose on my Linux.
But failed when I tried running it on my Window2000 with
ActivePerl5.6 today.
In the latter,there is no error reported.Just looks like
deadlock when the control enter the second cycle of the
while().
My English is not well.Maybe,tring it is better than my
explaining it : ).I'm a student in college.I love perl so I want to know the reason.
Many Many Thanks.

#!/usr/bin/perl

use FileHandle;
STDOUT->autoflush;
$sum=0;
while(1)
{
$sum++;
print "Round $sum:input a name\n";
chomp($name=<>);
$read="READ$name";
$write="WRITE$name";
pipe($read,$write);
$write->autoflush();

if(!($pid=fork))
{
close($write);
$read->autoflush();
while($content=<$read>){print "(I'm $name)Parent said:$content"}
close($read);
exit;
}

if(!defined($pid)){print "ERROR\n";exit;}
close($read);
$children{$name}=$write;
foreach $key (keys %children)
{
$it=$children{$key};
print $it "father's test\n";
}
sleep 1;
}

Replies are listed 'Best First'.
RE: This is difference?
by RichardH (Sexton) on May 02, 2000 at 21:37 UTC
    Support for forking in Perl 5.6 for windows is brand new, and what you are seeing is probably just the kind of flakiness you get with new additions to a piece of software.