Kevin Bewley
>
>    I'm trying to find my IP address from within Perl for eth0 and ppp0.
> Currently I run a regex on the output of ifconfig to extract his data -
> but, I'd like to do this from within Perl and it strikes me that this
> should be possible.

Hi Kevin.

This is from

  perldoc -q "IP address"

it should do the trick if you have a DNS entry for your machine.

  use Socket;
  use Sys::Hostname;
  my $host = hostname();
  my $ipaddr = inet_ntoa(scalar gethostbyname($host || 'localhost'));

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to