#!/usr/bin/perl -w $| ||= 1; use strict; my $MaxProcessCount = 5; for (1 .. $MaxProcessCount) { my $pid = fork; die "Unable to fork!" unless defined $pid; if($pid == 0) { SubFunction('localhost'); exit 0; } } sub SubFunction { my ($host) = @_; print "- process: $$\n"; my $fh; open($fh, '-|', "ping.exe $host") or die "couldn't open pipe!"; print while (<$fh>); close($fh); }