Angus wrote:
> Hello all,

Hello,

> I have found a very useful little module for parsing DHCP logs and in the
> following script I have been able to create a hash of hashes based on the
> data extracted from a dhcp log.  However, my problem now is that I want to
> determine what subnet a host is on.

You probably need a module like Net::IP or NetAddr::IP or Net::IP::Match, etc.

http://search.cpan.org/search?m=module&q=IP+address+subnet&s=1&n=50

> For the moment I will only be dealing
> with /25 subnets meaning hosts with a final octet greater than 128 or less
> than 128.  In my code below I tried to split the variable
> $dhcp{$hostname}->{ip} into 4 separate octets but that failed, I then tried
> to match the last 1 to 3 characters in $dhcp{$hostname}->{ip} but that also
> failed.   Can anyone tell me how I might do this?  I have included a short
> sample of the dhcp log I am parsing with this script.
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> system "clear";
> use Text::DHCPparse;

I wouldn't use that module as it has a flaw and it may not capture the hostname.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to