Thread if funktioniert nicht so wie ich mir vorstelle (9 answers)
Opened by rom2mor at 2008-03-03 14:43

rom2mor
 2008-03-03 14:43
#106576 #106576
User since
2008-03-03
1 Artikel
BenutzerIn
[default_avatar]
Hallo zusammen,

ich bin ein totaler Anfänger in perl, jedoch habe ich mir gedacht, diese Zeile sollten problemlos funktionieren:
Code (perl): (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
my $currentperiod = 'P08';
print "\nCurrent Period is (LE period is current period incremented by one): ". $currentperiod;

# next twelve if are used to increment current period by one
if ($currentperiod eq 'P01') {
                my $LEperiod = 'P02';
}
if ($currentperiod eq 'P02') {
                my $LEperiod = 'P03';
}
if ($currentperiod eq 'P03') {
                my $LEperiod = 'P04';
}
if ($currentperiod eq 'P04') {
                my $LEperiod = 'P05';
}
if ($currentperiod eq 'P05') {
                my $LEperiod = 'P06';
}
if ($currentperiod eq 'P06') {
                my $LEperiod = 'P07';
}
if ($currentperiod eq 'P07') {
                $LEperiod = 'P08';
}
if ($currentperiod eq 'P08') {
                $LEperiod =~ 'P09';
}
if ($currentperiod eq 'P09') {
                my $LEperiod = 'P10';
}
if ($currentperiod eq 'P10') {
                my $LEperiod = 'P11';
}
if ($currentperiod eq 'P11') {
                my $LEperiod = 'P12';
}
if ($currentperiod eq 'P12') {
                my $LEperiod = 'P01';
}
print "\nCurrent Period after ifs is: ". $currentperiod;
$LEperiod ="xxxx";
print "\nDefault LE period is : " . $LEperiod . "\n\n";

==========

Ergebnise:

Current Period is (LE period is current period incremented by one): P08
Current Period after ifs is: P08
Default LE period is : xxxx



WAS läuft hier schief?

Vielen Dank, Alexandru

View full thread if funktioniert nicht so wie ich mir vorstelle