Re: ANDing IP addresses

2003-01-03 Thread Nigel Wetters
On Tue, 2002-12-31 at 10:12, Mark Goland wrote: > I know there was already solution posted... Ditto. I'm a bit late with this, but there's plenty of example code in the IP::Country distribution of AND'ing IP addresses and looping through subnet masks. I tend to use only pack('N',... as this se

Re: ANDing IP addresses

2002-12-31 Thread Paul Johnson
On Sat, Dec 28, 2002 at 11:24:36PM -0800, R. Joseph Newton wrote: > I'd say don't bother pack()ing. At the moment, I think the function > pretty much s**ks. use eval() instead. The following doesn't have pack and unpack are good for what they are good at. If you need their functionality, use

Re: ANDing IP addresses

2002-12-31 Thread Mark Goland
;, $ip & $sn; sub CIDR2bin{ return pack 'c4',split /\./, shift; } - Original Message - From: "Kipp, James" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 27, 2002 11:31 AM Subject: RE: ANDing IP addresses > > > I want to b

RE: ANDing IP addresses

2002-12-30 Thread Kipp, James
> > I wrote this a while ago, it may give you some ideas. well if you saw my post a week ago about my troubles with vec(), playing with this will give me a chance to practice. thanks for the code, when i get a free moment i will have some fun with the this bit twiddling gem :-) seriously, this is

RE: ANDing IP addresses

2002-12-30 Thread Kipp, James
> Hi Kipp, > > I'd say don't bother pack()ing. At the moment, I think the > function pretty much s**ks. use eval() instead. The > following doesn't have that one-liner compactness of the > others, but it shows you what is going on. The bitwise & > does a real cute little trick with its ope

RE: ANDing IP addresses

2002-12-30 Thread Kipp, James
> > > > > > $ perl -e 'printf "%vd\n", 192.168.1.1 & 255.255.0.0' > > > 192.168.0.0 > > > > > > > quoting the string in anyway seems to break it. i am trying > to read in the > > strings from like this: > > print "Enter the IP address: "; > > $ip = ; > > print "Enter the Subnet address: "; > >

Re: ANDing IP addresses

2002-12-29 Thread John W. Krahn
James Kipp wrote: > > Happy Hollidays Hello, > I want to bitwize AND 2 IP adr strings, not sure of how to pack() them to be > able to AND them. before i start playing with pack,sprintf,socket,etc.. I > was wondering if someone already had a way. I wrote this a while ago, it may give you some id

Re: ANDing IP addresses

2002-12-28 Thread R. Joseph Newton
Hi Kipp, I'd say don't bother pack()ing. At the moment, I think the function pretty much s**ks. use eval() instead. The following doesn't have that one-liner compactness of the others, but it shows you what is going on. The bitwise & does a real cute little trick with its operands, evaluati

Re: ANDing IP addresses

2002-12-28 Thread Paul Johnson
On Fri, Dec 27, 2002 at 11:31:51AM -0500, Kipp, James wrote: > > > I want to bitwize AND 2 IP adr strings, not sure of how to > > pack() them to be > > > able to AND them. before i start playing with > > pack,sprintf,socket,etc.. I > > > was wondering if someone already had a way. > > > > $ perl

RE: ANDing IP addresses

2002-12-27 Thread Kipp, James
> > I want to bitwize AND 2 IP adr strings, not sure of how to > pack() them to be > > able to AND them. before i start playing with > pack,sprintf,socket,etc.. I > > was wondering if someone already had a way. > > $ perl -e 'printf "%vd\n", 192.168.1.1 & 255.255.0.0' > 192.168.0.0 > quoting t

RE: ANDing IP addresses

2002-12-27 Thread Kipp, James
> > $ perl -e 'printf "%vd\n", 192.168.1.1 & 255.255.0.0' > > 192.168.0.0 > > > that is great I had used ipcalc etc for doing such a simple thing > > But sir can u tell me how is "%vd" interpreted in printf You can read about v strings in "Programming Perl" , chap 2 under , section "V string lit

Re: ANDing IP addresses

2002-12-27 Thread Paul Johnson
On Fri, Dec 27, 2002 at 11:43:52AM +0530, Ramprasad wrote: > Paul Johnson wrote: > >On Thu, Dec 26, 2002 at 04:39:30PM -0500, Kipp, James wrote: > > > >>Happy Hollidays > >> > >>I want to bitwize AND 2 IP adr strings, not sure of how to pack() them to > >>be > >>able to AND them. before i start p

Re: ANDing IP addresses

2002-12-26 Thread Ramprasad
Paul Johnson wrote: On Thu, Dec 26, 2002 at 04:39:30PM -0500, Kipp, James wrote: Happy Hollidays I want to bitwize AND 2 IP adr strings, not sure of how to pack() them to be able to AND them. before i start playing with pack,sprintf,socket,etc.. I was wondering if someone already had a way.

Re: ANDing IP addresses

2002-12-26 Thread Paul Johnson
On Thu, Dec 26, 2002 at 04:39:30PM -0500, Kipp, James wrote: > Happy Hollidays > > I want to bitwize AND 2 IP adr strings, not sure of how to pack() them to be > able to AND them. before i start playing with pack,sprintf,socket,etc.. I > was wondering if someone already had a way. $ perl -e 'prin

ANDing IP addresses

2002-12-26 Thread Kipp, James
Happy Hollidays I want to bitwize AND 2 IP adr strings, not sure of how to pack() them to be able to AND them. before i start playing with pack,sprintf,socket,etc.. I was wondering if someone already had a way. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-m