in reply to IO Socket - Detect inbound IP
You can use the peerhost (and peerport) methods.
IO::Socket::INET