in reply to Win32 fork() "problem"

I get similar behavior on Win2000. The fork appears to mess with the file handle:
#!/usr/bin/perl use strict; use warnings; my $x=0; while (my $computer=<DATA>) { print "computer: [$computer]"; chomp($computer); $x++; my $pid = fork(); if ($pid) { print "Parent $$ got PID $pid from fork($$ $computer)\n"; sleep(1); }else { print "\t$$ $computer\n"; exit(0); } if($x > 4) { do { $pid=wait() } while ($pid != -1); $x=0; } } my $pid; do { $pid=wait() } while ($pid != -1); print "wait() ed until $pid was returned.\n"; close(DATA); __DATA__ Computer1 Computer2 Computer3 # Output computer: [Computer1 ]Parent 1782987 got PID -1853375 from fork(1782987 Computer1) -1853375 Computer1 computer: [ ]Parent 1782987 got PID -1852747 from fork(1782987 ) -1852747 computer: [Computer2 ]Parent 1782987 got PID -1805143 from fork(1782987 Computer2) -1805143 Computer2 computer: [ ]Parent 1782987 got PID -1804643 from fork(1782987 ) -1804643 computer: [Computer3 ]Parent 1782987 got PID -1898099 from fork(1782987 Computer3) -1898099 Computer3 wait() ed until -1 was returned.
The problem goes away if you slurp the input first, like:
for my $computer (<DATA>) { ...