in reply to IO::Socket/multiple connections related

IO::Select could work too. Get a list of the connections that have data to read from using IO::Select->select, and then read a line from each of them before going back to wait for more input. Only read from the sockets that have something to read, and you won't block.
my $readable = IO::Select->new; $readable->add($oneSock, $twoSock, $redSock, $blueSock); while (not $done) { my $ready = IO::Select->select($readable); foreach my $socket (@$ready) { # Deal with whatever $socket has to say } }