sub ServerRun { my ($server)=@_; my ($client); #wait for client connections while ($client = $server->accept()) { $client->autoflush(1); my $pid = fork; if ($pid == 0) { my $clsock=HandleClient($client); close $clsock; exit 0; } } } sub HandleClient { # this just recieves system commands # to be executed and returns output to client # fn. returns the $client socket }