Perl has native support for socket programming. No need to use an auxiliar program as netcat for that.
For reading/writing data from several sockets as it arrives, you have to use select or IO::Select or some framework that builds on it (or in some equivalent OS call), for instance POE.
Comment on Re: Managing multiple bi-directional pipes