![]() |
![]() |
8 Einträge, 1 Seite |
1
2
3
4
5
6
REPORTLOG +"report.log"
TIMEOUTALL 7200
GROUP berlin otto walter hans
EXCLUDE PROE GROUP maulburg
GROUP stuttgart administrator ja sae wd
GROUP karlsruhe ic ae tt op
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$file = 'ptc.opt';
open(INFO, $file);
@lines = <INFO>;
my $groupname;
for (my $i=0;$i<@lines;$i++){
my @reihe = split(/ /, $lines[$i]);
my @groupmember;
if($reihe[0] eq "GROUP"){
$groupname = $reihe[1];
for (my $x=0;$x<@reihe;$x++){
if($x>1){
push(@groupmember,$reihe[$x]);
}
}
}
$groups{$groupname} = [@groupmember];
}
foreach $gruppe (keys(%groups)) {
print "\n".$gruppe.":\n ";
for(my $g=0;$g<@{$groups{$gruppe}};$g++){
print @{$groups{$gruppe}}[$g]." ";
}
}
close(INFO);
QuoteUse of uninitialized value in hash element at test.pl line 24, <INFO> line 6.
Use of uninitialized value in hash element at test.pl line 24, <INFO> line 6.
:
stuttgart:
administrator ja sae wd
karlsruhe:
ic ae tt op
berlin:
QuoteDabei sage ich doch explizit "Nur wenn $reihe[0] gleich "GROUP" ist dann fülle $groupmembers...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
open(INFO, "<ptc.opt") or die "$!";
while ( my $line = <INFO> ) {
next unless $line =~ /^GROUP/;
chomp $line;
$line =~ /GROUP ([^ ]*) (.*)/;
push @{ $groups{$1} }, split( " ", $2 );
}
close INFO;
for my $key ( sort keys %groups ) {
print "$key:\n";
print join( " ", @{ $groups{$key} } ), "\n";
print "\n";
}
1
2
3
4
5
6
while ( my $line = <INFO> ) {
next unless $line =~ /^GROUP/;
chomp $line;
my (undef,$groupname,@groupmembers) = split(/\s+/,$line);
push(@{$groups{$groupname} }, @groupmembers);
}
my %groups = map { my(undef, $g, @g) = split; $g, [@g] } grep /^GROUP/, <INFO>;
1
2
3
4
5
6
7
8
9
10
11
12
13
for (my $i=0;$i<@lines;$i++){
my @reihe = split(/ /, $lines[$i]);
my @groupmember;
if($reihe[0] =~ m/GROUP/){
$groupname = $reihe[1];
for (my $x=0;$x<@reihe;$x++){
if($x>1){
push(@groupmember,$reihe[$x]);
}
}
$groups{$groupname} = [@groupmember]; # Getauscht mit
} # Dieser Zeile
}
![]() |
![]() |
8 Einträge, 1 Seite |