Peter Jay Salzman said:

> for machines with one IP address (disregarding lo), just use the output
> of ifconfig with a little regex handling:
>
> [EMAIL PROTECTED] ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:C0:F0:48:DF:5A
>           inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
> ^^^^^^^^^^^^^^^^^^^^^
>           you want this.

Perfect.  This is what I used:

my $IP = '';
my @lines = qx|/usr/sbin/ifconfig hme0| or die "Could not get execute
ifconfig: $!\n";
foreach (@lines) {
  if (/inet ([\d.]+)/) {
    $IP = $1;
  }
}

Seems to work like a charm.  Thanks, Pete.

Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is
invisible to the eye." --Antoine de Saint Exup�ry


_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to