./perl/test/ng/frk1.pl

download original
#!/usr/bin/perl -w

@hosts=('localhost', 'www.perl.com', 'www.yahoo.com');


foreach (@hosts) {
        if ($pid=fork) {
                push(@children, $pid);
                $host="";
        } else {
                @children=();
                $host=$_;
                last;
        }
}

print "hi, my children are @children, my host is $host.\n\n";

  
back to ng

(C) 1998-2017 Olaf Klischat <olaf.klischat@gmail.com>