Thread Perlmodul zum DHCPD.conf parsen (2 answers)
Opened by OnkelBlacky at 2006-02-01 09:21

GwenDragon
 2006-02-01 09:38
#6832 #6832
User since
2005-01-17
14607 Artikel
Admin1
[Homepage]
user image
Was brauchst du? Den host-name?

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/local/bin/perl
use strict;


my @hosts = ();
open( F, './dhcp.conf') or die "$!";
foreach my $s ( <F> ) {
my ($hostname) = $s =~ /\s+host-name\s+"?([^;"]+)"?;/;
push @hosts,$hostname if defined $hostname;
}
close ( F );

print "Rechner: \n", join( "\n", @hosts);

1;

View full thread Perlmodul zum DHCPD.conf parsen