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
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
;, $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
>
> 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
> 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
> > >
> > > $ 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: ";
> >
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
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
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
> > 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
> > $ 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
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
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.
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
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
15 matches
Mail list logo