RE: problems parsing a DHCP.leases file.

2006-03-02 Thread Angus
? Thanks again for the example it is really interesting and has helped me. -angus -Original Message- From: Hans Meier (John Doe) [mailto:[EMAIL PROTECTED] Sent: Monday, February 27, 2006 12:53 AM To: beginners@perl.org Subject: Re: problems parsing a DHCP.leases file. Angus am Montag, 27

Re: problems parsing a DHCP.leases file.

2006-03-02 Thread John W. Krahn
[ Please do not top-post. Please remove any quoted text that is not relevant to your post. ] Angus wrote: From: Hans Meier (John Doe) Here is a way to process one lease { } after another, with the possibility to extract every field you want. I think it is easy to read, understand, and

Re: problems parsing a DHCP.leases file.

2006-02-27 Thread Jeff Pang
Hi, here is wrong: elsif ($line =~ /^client-hostname/) { $hostname = $1; } for the line like that: client-hostname HOST1; I think maybe you should do: elsif ($line =~ /^\s*client-hostname\s+\(.*?)\){ $hostname = $1;} HTH. -- Jeff Pang NetEase AntiSpam Team

Re: problems parsing a DHCP.leases file.

2006-02-27 Thread The Ghost
you need to match something. You probably meant: elsif ($line =~ /^client-hostname\s+([a-z0-9\-\.]+)/i) { On the other hand, there is probably a module that already deals with this and would save you even more coding time. Ryan On Feb 27, 2006, at 1:25 AM, Angus wrote: elsif ($line

RE: problems parsing a DHCP.leases file.

2006-02-27 Thread Angus
match but it still returns an undef variable... -angus -Original Message- From: The Ghost [mailto:[EMAIL PROTECTED] Sent: Monday, February 27, 2006 12:13 AM To: Angus Cc: beginners@perl.org Subject: Re: problems parsing a DHCP.leases file. you need to match something. You probably

Re: problems parsing a DHCP.leases file.

2006-02-27 Thread The Ghost
When I change to : ... elsif ($line =~ /^\s+?client-hostname\s+([a-z0-9\-\.]+)/i) { ... I found IP:10.10.97.207 I found Hostname: I found IP:10.10.97.207 I found Hostname: HOST1 Seems you have some space there. Also, you probably want to move your my $hostname and my $ip statements. If a

Re: problems parsing a DHCP.leases file.

2006-02-27 Thread Hans Meier (John Doe)
Angus am Montag, 27. Februar 2006 08.25: Hi all, I am having some problems filling a variable based on the contents of a dhcpd.leases file. All I want at this time is the hostname and ip address. My eventual goal is to create hash of hashes with this information but for now I just want to

problems parsing a DHCP.leases file.

2006-02-26 Thread Angus
Hi all, I am having some problems filling a variable based on the contents of a dhcpd.leases file. All I want at this time is the hostname and ip address. My eventual goal is to create hash of hashes with this information but for now I just want to read in the file and see that I have defined