RE: finding out my IP address..
From: Chris McMahon (CMcMahon_at_loronix.com)
Date: 10/30/03
- Next message: Peter Scott: "Re: Corrupted Data"
- Previous message: Harry Putnam: "Control a non-perl image viewer from perl script"
- Maybe in reply to: Kevin Bewley: "finding out my IP address.."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: "'Kevin.Bewley@hpa.org.uk'" <Kevin.Bewley@hpa.org.uk>, beginners@perl.org Date: Thu, 30 Oct 2003 08:31:35 -0700
I faced this just a couple of days ago on a FreeBSD system for em0.
Here's what I did:
($in, $myip, $rest) = split / /,qx/ifconfig|grep 192.168/;
print "This IP is $myip\n";
I used the FreeBSD "ifconfig" system call and parsed the output with
split. Whatever system you're on will probably have some other systemly way
to find this information.
-Chris
-----Original Message-----
From: Kevin.Bewley@hpa.org.uk [mailto:Kevin.Bewley@hpa.org.uk]
Sent: Wednesday, October 29, 2003 6:41 AM
To: beginners@perl.org
Subject: finding out my IP address..
Hi,
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.
HELP! ANYBODY!
Kev
- Next message: Peter Scott: "Re: Corrupted Data"
- Previous message: Harry Putnam: "Control a non-perl image viewer from perl script"
- Maybe in reply to: Kevin Bewley: "finding out my IP address.."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|