# $sock is the socket: this will work if you aren't using IO::Socket: ($port, $iaddr) = sockaddr_in(getpeername($sock)); $peer_addr = inet_ntoa($iaddr); # String, numbers and dots notation # Or, if you're using IO::Socket $peer_addr = $sock->peerhost();