in reply to Boolean logic with IP addresses

Given the fact that $ip holds a valid IP-Address:
my @parts=split('\.',$ip); my $ipint=$parts[0]*256**3+$parts[1]*256**2+$parts[2]*256+$parts[3]; undef @parts;
There might be trickier ways but that should do for the start :)

Update: Of course the MSB is in the first digit, it came to my mind when traveling home yesterday, sorry.... Thanks, jink. Well thought :)
--
use signature; signature(" So long\nAlfie");

Replies are listed 'Best First'.
Re: Re: Boolean logic with IP addresses
by jink (Scribe) on May 18, 2001 at 13:31 UTC
    Isn't that supposed to be:
    my $ipint=$parts[0]*256**3+$parts[1]*256**2+$parts[2]*256+$parts[3];
    See azatoths reply.

    All Camels are equal, but some Camels are more equal than others.