Re: string into a unique index

2011-11-27 Thread Dr.Ruud
On 2011-11-23 04:24, Arvind wrote: [...] I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. I want to do it in a way that there is very low probability of the number created from A.B.C.D being the same as that created from E.F.G.H. Try

Re: string into a unique index

2011-11-27 Thread Shawn H Corey
On 11-11-27 04:46 AM, Dr.Ruud wrote: On 2011-11-23 04:24, Arvind wrote: [...] I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. I want to do it in a way that there is very low probability of the number created from A.B.C.D being the

string into a unique index

2011-11-23 Thread Arvind
I have to write a perl script that keeps track of tcp connections. I plan to keep track of this in an array of the form tcp_connection[source address][dest address] To do this I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. I want to

Re: string into a unique index

2011-11-23 Thread Petite Abeille
On Nov 23, 2011, at 4:24 AM, Arvind wrote: To do this I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. Well, IP4 addresses can simply be represented as a decimal. So, 127.0.0.1 is 2130706433. Example on how to calculate it:

Re: string into a unique index

2011-11-23 Thread Uri Guttman
On 11/22/2011 10:24 PM, Arvind wrote: I have to write a perl script that keeps track of tcp connections. I plan to keep track of this in an array of the form tcp_connection[source address][dest address] To do this I want to convert an IP address of the form A.B.C.D into a number that will

Re: string into a unique index

2011-11-23 Thread John W. Krahn
Petite Abeille wrote: On Nov 23, 2011, at 4:24 AM, Arvind wrote: To do this I want to convert an IP address of the form A.B.C.D into a number that will serve as an index of the array. Well, IP4 addresses can simply be represented as a decimal. So, 127.0.0.1 is 2130706433. Or as a four

Re: string into a unique index

2011-11-23 Thread shawn wilson
On Nov 23, 2011 4:50 AM, Arvind arvind@gmail.com wrote: I have to write a perl script that keeps track of tcp connections. I plan to keep track of this in an array of the form tcp_connection[source address][dest address] I would just use a db for this if not only for the audit trail. I