Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Boolean logic with IP addresses

by alfie (Pilgrim)
on May 17, 2001 at 17:38 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-01-20 12:09 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (56 votes). Check out past polls.