RE: finding out my IP address..

From: Chris McMahon (CMcMahon_at_loronix.com)
Date: 10/30/03


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



Relevant Pages

  • Re: finding out my IP address..
    ... I'd like to do this from within Perl and it strikes me that this ... trying to find out what my Internet or ppp0 IP address is. ... Kev ...
    (perl.beginners)
  • ANNOUNCE: Archive::Zip 1.13 released
    ... don't use Perl any more, ... files), extract a file, and then re-write the zip, you will get a ... Members can be created from members in existing ... - FAQ NAME fix from Michael Schwern ...
    (comp.lang.perl.modules)
  • RE: Optimization for faster select...
    ... Although its a cute idea to create a function based index on SUBSTR ... I tried to see whether the SUBSTR could be replaced with Perl formatting ... the possibility of writes delaying the extract. ... So, ladies and gets, everything comes down to using RowCacheSize attribute. ...
    (perl.dbi.users)
  • Re: Extracting Text
    ... >> recommended to extract text from a text file and placed into a ... I think gawk or awk would be the best thing for the OP to use too. ... editors such as Perl or Emacs Lisp. ...
    (comp.programming)
  • Re: How to extract .tar files in different directory?
    ... From perl you can execute any unix command using system. ... could anyone tell me if I can extract these big ... ..tar files without using large amount of my PC memory? ... foreach $direntry ) ...
    (comp.lang.perl.misc)