in reply to How to share streams between processes

Fork a new thread B
You don't fork threads :) ok maybe if you use forks

Worth reading are Bidirectional Communication with Another Process

Bidirectional Communication with Yourself

Also worth investigating are IPC::Open3::Simple and/or IPC::Run3

  • Comment on Re: How to share streams between processes