use threads qw( async ); use Thread::Queue qw( ); my $q = Threads::Queue->new(); async { while () { $q->enqueue(...); } $q->enqueue(...); }; async { while (<$fr_child_pipe>) { $q->enqueue(...); } $q->enqueue(...); }; while (defined(my $item = $q->dequeue())) { ... } #### use threads qw( async ); use Win32::Socketpair qw( winsocketpair ); my ($fr_parent_sock, $fr_parent_sock_writer) = winsocketpair(); async { print($fr_parent_sock_writer $_) while ; close($fr_parent_sock_writer); }; my ($fr_child_sock, $fr_child_sock_writer) = winsocketpair(); async { print($fr_child_sock_writer $_) while <$fr_child_pipe>; close($fr_child_sock_writer); }; ... select $fr_parent_sock and $fr_child_sock ...