Thread Ein string auf ein Musterüberprüfen ! (51 answers)
Opened by mr-sansibar at 2007-06-29 17:48

mr-sansibar
 2007-07-10 16:11
#78060 #78060
User since
2006-04-13
90 Artikel
BenutzerIn
[default_avatar]
Code: (dl )
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
foreach my $logFile(@logfilelist) {

open my $in , '<', $logFile or die $!;
print "Umstrukturieren $logFile \n";
while( my $line = <$in> ){
if( $line =~ /^Context/ ){
$line=~ s/^Context:\s+//;
@array = split /\s/, $line;
$line = join "|", @array;
if( $array[2] ne '' ){

$counter++;

if($logFile =~ /^dn/) {

print $frontend_context "$counter|$line\n";

}

elsif($logFile =~ /^logfile/ || /^inoutput/) {

print $backend_context "$counter|$line\n";

}
}

}
}


wenn die erste if-anweisung: if($logFile =~ /^dn/) false zurück liefert, dann muss er doch in die elsif springen: elsif($logFile =~ /^logfile/ || /^inoutput/)

aber bei mir haut das nicht so ganz hin. obwohl im scalar das richtige muster gespeichert ist, um in die elsif-anweisung auszuführen ???

View full thread Ein string auf ein Musterüberprüfen !