use strict; use Sys::Hostname; use Socket; my $host = hostname(); my $ip = inet_ntoa(scalar(gethostbyname($host))); print $ip;