blob: 6342c8958652c3ae8e5fb7dade8b93f8767b47e3 (
plain)
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
44
45
46
47
48
49
|
#!./perl
# $Header: cmd.for,v 2.0 88/06/05 00:12:19 root Exp $
print "1..7\n";
for ($i = 0; $i <= 10; $i++) {
$x[$i] = $i;
}
$y = $x[10];
print "#1 :$y: eq :10:\n";
$y = join(' ', @x);
print "#1 :$y: eq :0 1 2 3 4 5 6 7 8 9 10:\n";
if (join(' ', @x) eq '0 1 2 3 4 5 6 7 8 9 10') {
print "ok 1\n";
} else {
print "not ok 1\n";
}
$i = $c = 0;
for (;;) {
$c++;
last if $i++ > 10;
}
if ($c == 12) {print "ok 2\n";} else {print "not ok 2\n";}
$foo = 3210;
@ary = (1,2,3,4,5);
foreach $foo (@ary) {
$foo *= 2;
}
if (join('',@ary) eq '246810') {print "ok 3\n";} else {print "not ok 3\n";}
for (@ary) {
s/(.*)/ok $1\n/;
}
print $ary[1];
# test for internal scratch array generation
# this also tests that $foo was restored to 3210 after test 3
for (split(' ','a b c d e')) {
$foo .= $_;
}
if ($foo eq '3210abcde') {print "ok 5\n";} else {print "not ok 5\n";}
foreach $foo (("ok 6\n","ok 7\n")) {
print $foo;
}
|