On Thu, 7 Feb 2002, Orlando Andico wrote:

> Here's another way:
> 
> my $mask = (2^($masklen + 1)) - 1;
> 
> unfortunately there doesn't seem to be an exponentiation operator in
> Perl..
> 
> 

exponents is expressed like 2 ** 3 = 8; 

pwede rin ito:

$bits=24;
$fullmask = 2 ** 32;
$netmask = $fullmask << (32-$bits);
$hosts = $fullmask - $netmask;
print "No. of hosts: $hosts\n";



pong

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to