use IO::Select; print "($$) parent\n"; $| = 1; my $timeout = 1; if ( my $pid = open my $fh, "-|" ) {    print "($$) opened $pid\n";    my $s = IO::Select->new;    $s->add($fh);    my $ready;    while (not(($ready) = $s->can_read($timeout))) {        print ".";    }    print $/;    chomp, print "($$) got ($_) from child\n" while <$ready>;                                         } elsif (defined $pid) {    sleep 3;    print "($$) i am the child and i finished my work\n"; exit; }