#!/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; open RCMD, "rcmd \\\\$server ipconfig|"; while (){if ($_=~/Executing/){print "$_\n";}} close RCMD; sleep 1; }