use strict; use warnings; use Socket; $| = 1; my ($kidfh, $dadfh); socketpair($kidfh, $dadfh, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!"; if (my $pid = fork) { close $dadfh; print $kidfh "Parent Pid $$ sendet dies\n"; # PARENT HAENGT HIER chomp(my $line = <$kidfh>); print "Parent Pid $$ liest gerade dies: $line\n"; close $kidfh; waitpid($pid,0); } else { close $kidfh; # CHILD HAENGT HIER chomp(my $line = <$dadfh>); print "Child Pid $$ liest gerade dies: $line\n"; print $dadfh "Child Pid $$ sendet dies\n"; close $dadfh; exit; }