Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Boolean logic with IP addresses

by alfie (Pilgrim)
on May 17, 2001 at 17:38 UTC ( [id://81228]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://81228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-20 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found