Tweak to hints/machten.sh: stop t/lib/complex.t from failing
[p5sagit/p5-mst-13.2.git] / t / op / my.t
CommitLineData
93a17b20 1#!./perl
2
a6006777 3# $RCSfile: my.t,v $
93a17b20 4
a6006777 5print "1..28\n";
93a17b20 6
7sub foo {
8 my($a, $b) = @_;
9 my $c;
10 my $d;
11 $c = "ok 3\n";
12 $d = "ok 4\n";
13 { my($a,$c) = ("ok 9\n", "ok 10\n"); ($x, $y) = ($a, $c); }
14 print $a, $b;
15 $c . $d;
16}
17
18$a = "ok 5\n";
19$b = "ok 6\n";
20$c = "ok 7\n";
21$d = "ok 8\n";
22
23print &foo("ok 1\n","ok 2\n");
24
25print $a,$b,$c,$d,$x,$y;
26
27# same thing, only with arrays and associative arrays
28
29sub foo2 {
30 my($a, @b) = @_;
31 my(@c, %d);
32 @c = "ok 13\n";
33 $d{''} = "ok 14\n";
34 { my($a,@c) = ("ok 19\n", "ok 20\n"); ($x, $y) = ($a, @c); }
35 print $a, @b;
36 $c[0] . $d{''};
37}
38
39$a = "ok 15\n";
40@b = "ok 16\n";
41@c = "ok 17\n";
42$d{''} = "ok 18\n";
43
44print &foo2("ok 11\n","ok 12\n");
45
46print $a,@b,@c,%d,$x,$y;
a6006777 47
48my $i = "outer";
49
50if (my $i = "inner") {
51 print "not " if $i ne "inner";
52}
53print "ok 21\n";
54
55if ((my $i = 1) == 0) {
56 print "not ";
57}
58else {
59 print "not" if $i != 1;
60}
61print "ok 22\n";
62
63my $j = 5;
64while (my $i = --$j) {
65 print("not "), last unless $i > 0;
66}
67continue {
68 print("not "), last unless $i > 0;
69}
70print "ok 23\n";
71
72$j = 5;
73for (my $i = 0; (my $k = $i) < $j; ++$i) {
74 print("not "), last unless $i >= 0 && $i < $j && $i == $k;
75}
76print "ok 24\n";
77print "not " if defined $k;
78print "ok 25\n";
79
80foreach my $i (26, 27) {
81 print "ok $i\n";
82}
83
84print "not " if $i ne "outer";
85print "ok 28\n";