1
2
3
4
5
6
7
8
9
10
11
12
13
for($i = 0; $i < @lines; $i++){
if($lines[$i+1] =~ /<SW-SYSCOND>/gi) {
#if($lines[$i] =~ ! /DSM_MODIFY_FID/gi || $lines[$i] =~ ! /DSM_FID_ADD/gi) {
#splice (@lines, $i,1,"");
#}
if($lines[$i] =~ /DSM_MODIFY_FID/gi)
{ print OUTPUT2 "$i DSM_MODIFY_FID\n";}
elsif($lines[$i] =~ /DSM_FID_ADD/gi)
{ print OUTPUT2 "$i DSM_FID_ADD\n";}
else {print OUTPUT2 "NICHTS VON ALLEM!!!!\n";}
}
}
if($lines[$i] =~ ! /DSM_MODIFY_FID/gi || $lines[$i] =~ ! /DSM_FID_ADD/gi) {
if($lines[$i] !~ /DSM_MODIFY_FID/gi || $lines[$i] !~ /DSM_FID_ADD/gi) {
if($lines[$i+1] =~ /<SW-SYSCOND>/gi) {
1
2
3
4
for($i = 0; $i < @lines; $i++){
print"$lines[$i]";
if($lines[$i] =~ /(<SW-SYSCOND>.*<\/SW-SYSCOND>)/gi) {
print"geklappt";
<SW-SYSCOND>((<SW-SYSTEMCONST-CODED-REF>S1B1_SY</SW-SYSTEMCONST-CODED-REF> == 2) || (<SW-SYSTEMCONST-CODED-REF>S1B2_SY</SW-SYSTEMCONST-CODED-REF> == 2) || (<SW-SYSTEMCONST-CODED-REF>S2B1_SY</SW-SYSTEMCONST-CODED-REF> == 2) || (<SW-SYSTEMCONST-CODED-REF>S3B1_SY</SW-SYSTEMCONST-CODED-REF> == 2) ||<SW-SYSTEMCONST-CODED-REF>K1_SC</SW-SYSTEMCONST-CODED-REF>)</SW-SYSCOND>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ perl -Mstrict -w
my @arr = (
'bla',
'<SW-SYSCOND>((<SW-SYSTEMCONST-CODED-REF>S1B1_SY</SW-SYSTEMCONST-CODED-REF> == 2) || (<SW-SYSTEMCONST-CODED-REF>S1B2_SY</SW-SYSTEMCONST-CODED-REF> == 2) || (<SW-SYSTEMCONST-CODED-REF>S2B1_SY</SW-SYSTEMCONST-CODED-REF> == 2) || (<SW-SYSTEMCONST-CODED-REF>S3B1_SY</SW-SYSTEMCONST-CODED-REF> == 2) ||<SW-SYSTEMCONST-CODED-REF>K1_SC</SW-SYSTEMCONST-CODED-REF>)</SW-SYSCOND>',
);
for ( @arr ) {
if ( m/(<SW-SYSCOND>.*<\/SW-SYSCOND>)/gi ) {
print "yes\n";
}
else {
print "no\n";
}
}
^D
no
yes
2016-03-18T13:49:58 samuelkOK, ich hab den Fehler eingegrenzt....
Er springt garnicht immer in die if Schleife: if($lines[$i+1] =~ /<SW-SYSCOND>/gi) {
Gibt es probleme, wie ich $i+1 nutze?
ich benutze so etwas schon mehrmals vorher, deshalb wundert es mich...