File::Tail has native support for this. Search its documentation for the select method. It even has an example.
Update: I thought you had mentioned you were using File::Tail. Ignore this post, it won't help you since File::Tail won't work with sockets. You need IO::Select
Comment on Re: IO::Socket/multiple connections related