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

renee
 2008-03-03 14:54
#106581 #106581
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Lösung mit Hash:
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
my $currentperiod = 'P08';
print "\nCurrent Period is (LE period is current period incremented by one): ". $currentperiod;
my $LEperiod = 'xxxxx';

my %hash = (
   P01 => 'P02',
   P02 => 'P03',
   P03 => 'P04',
   P04 => 'P05',
   P05 => 'P06',
   P06 => 'P07',
   P07 => 'P08',
   P08 => 'P09',
   P09 => 'P10',
   P10 => 'P11',
   P11 => 'P12',
   P12 => 'P01',
);

if( exists $hash{ $currentperiod } ){
   $LEperiod = $hash{$currentperiod};
}

print "\nCurrent Period after ifs is: ". $currentperiod;
print "\nDefault LE period is : " . $LEperiod . "\n\n";
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread if funktioniert nicht so wie ich mir vorstelle