in reply to convert longIP to stringIP

This "longIP" is a valid IP already. You probably do not need to convert it.

Converting it is easy if you tread the IP as an IP :)

use Socket qw(inet_aton inet_ntoa); print inet_ntoa(inet_aton('2130706433'));

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Replies are listed 'Best First'.
Re: Re: convert longIP to stringIP
by tbone (Beadle) on Sep 12, 2003 at 18:21 UTC
    Juerd,
    Thanks...however my long number is negative and it doesnt seem to work?
    My number is -1675066731. Any ideas?

      Try this:

      use Socket qw(inet_aton inet_ntoa); my $num = -1675066731; print inet_ntoa(inet_aton(hex(sprintf "%x", $num))); __DATA__ 156.40.130.149