[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Webservers, perl, and IP addresses



cybom@mail2.netropolis.net writes:
>Currently I'm running MacHTTP on my mac and I was wondering: how can 
>I make a perl script using MacPERL that will: get my IP address 
>everytime I sign on to my ISP. Could anyone help me?!??

The following will work in MacPerl5:

chomp($host = `hostname`);
print join(".", unpack("CCCC", (gethostbyname($host))[4])), "\n";

Matthias

-----
Matthias Neeracher                                   neeri@iis.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_