Leser: 5
![]() |
|< 1 ... 7 8 9 10 11 12 13 >| | ![]() |
124 Einträge, 13 Seiten |
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
#!/usr/local/bin/perl5.9.4
use feature ':5.10';
my $x;
$x err say "\$x ist undefiniert. (1)";
$x = 0;
$x err say "\$x ist undefiniert. (2)";
$x = 1; # was missing in 1st version
given ($x) {
when (1) { say "\$x ist 1" }
default { say "\$x ist nicht 1" }
}
$x ~~ [1..4] and say "\$x ist innerhalb 1..4";
$x !~~ [2..4] and say "\$x ist nicht innerhalb 2..4";
_ _ END _ _
ergibt:
$x ist undefiniert. (1)
$x ist 1
$x ist innerhalb 1..4
$x ist nicht innerhalb 2..4
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/local/bin/perl5.9.4
use feature ':5.10';
my $x;
$x err say "\$x ist undefiniert. (1)";
$x = 0;
$x err say "\$x ist undefiniert. (2)";
given ($x) {
when (1) { say "\$x ist 1" }
default { say "\$x ist nicht 1" }
}
$x ~~ [1..4] and say "\$x ist innerhalb 1..4";
$x !~~ [2..4] and say "\$x ist nicht innerhalb 2..4";
_ _ END _ _
ergibt:
$x ist undefiniert. (1)
$x ist 1
$x ist innerhalb 1..4
$x ist nicht innerhalb 2..4
![]() |
|< 1 ... 7 8 9 10 11 12 13 >| | ![]() |
124 Einträge, 13 Seiten |