It looks like your &doit routine is not returning. On win2k this works fine (once you fix your typos so it will compile :o)
C:\>type test.pl #!/usr/bin/perl -w use strict; $|=1; my @ip = qw (192.168.0.1 192.168.0.2 192.168.0.3); my $kid; foreach my $host(@ip) { next if $kid = fork; die "fork: $!" unless defined $kid; & doit($host); exit; } 1 while wait != -1; print "Parent exiting...\n"; exit; sub doit { my $server = shift; print "Doin it to $server, stand clear of the doors please!\n"; } C:\>perl test.pl Doin it to 192.168.0.1, stand clear of the doors please! Doin it to 192.168.0.2, stand clear of the doors please! Doin it to 192.168.0.3, stand clear of the doors please! Parent exiting... C:\>
Add some debugging print statements so you can see WHERE it is hanging.
cheers
tachyon
In reply to Re: 1 while wait != -1; on w2k
by tachyon
in thread 1 while wait != -1; on w2k
by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |