I think there is a bug(let) in IO::Socket::INET. Local* is ignored if there is a PeerAddr. Annoyingly you will need it in your code. Otherwise your code should be good. Are you sure that the answer is printable and is not cut short at the first \x00?