... use strict; use feature qw(say); use Socket; ... my $remote_ip = $ENV{REMOTE_ADDR}; # note: don't try this at home kids, unless you have a fast local DNS (server) my $remote_host = gethostbyaddr(inet_aton($remote_ip), AF_INET);