Thread Variable gegen Liste vergleichen (14 answers)
Opened by rc27 at 2013-06-27 10:03

payx
 2013-06-27 10:25
#168624 #168624
User since
2006-05-04
564 Artikel
BenutzerIn

user image
Hallo rc27,

löse das mit einem 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
#!/usr/bin/perl

use strict;
use warnings;

my $record_type_status;

my %record_types = (
    100 => 1
    , 200 => 1
    , 300 => 1
    , 400 => 1
    , 500 => 1
);

my $record_type_found = "101";

if ($record_types{$record_type_found}) { 
    $record_type_status = "ok"; 
} else {
    $record_type_status = "not ok"; #
}

print $record_type_found, ": ", $record_type_status, "\n";

HTH
Grüße
payx

View full thread Variable gegen Liste vergleichen