> > 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 the string in anyway seems to break it. i am trying to read in the
strings from <STDIN> like this:
print "Enter the IP address: ";
$ip = <STDIN>;
print "Enter the Subnet address: ";
$sn = <STDIN>;

printf "The network adr is: %vd\n", $ip & $sn;
--
output: 
Enter the IP address: 192.168.1.1
192.168.1.1

Enter the Subnet address: 255.255.255.0
255.255.255.0

The network adr is: 48.49.48.46.48.52.48.46.48.36.49.10
---

how can i make this work ?

Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to