use Socket; use Sys::Hostname; my $hostname = hostname(); my $name ='yahoo.com'; my $ip = inet_ntoa(scalar(gethostbyname($name)) || 'localhost'); my $myip = inet_ntoa(scalar(gethostbyname($hostname))); print $ip, "\n", $myip; __END__ sample output: 216.115.108.245 4.52.23.253
"cRaZy is co01, but sometimes cRaZy is cRaZy".
- crazyinsomniac
In reply to (crazyinsomniac) Re: Finding your IP address with Perl
by crazyinsomniac
in thread Finding your IP address with Perl
by $ENV{REMOTE_USER}
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |