use strict; use Socket; my $p = gethostbyname('localhost'); my $ip = inet_ntoa($p); print "$ip\n";