I would suspect a proper answer might be found in the Unix Socket FAQ. Yes, I know it's Unix. Yes, I know the examples are given in C. The important thing is that sockets in Perl are remarkably similar.
Question 4.13 appears to give an applicable answer.