5 for ($i = 0; $i <= 10; $i++) {
9 print "#1 :$y: eq :10:\n";
11 print "#1 :$y: eq :0 1 2 3 4 5 6 7 8 9 10:\n";
12 if (join(' ', @x) eq '0 1 2 3 4 5 6 7 8 9 10') {
23 if ($c == 12) {print "ok 2\n";} else {print "not ok 2\n";}
30 if (join('',@ary) eq '246810') {print "ok 3\n";} else {print "not ok 3\n";}
38 # test for internal scratch array generation
39 # this also tests that $foo was restored to 3210 after test 3
40 for (split(' ','a b c d e')) {
43 if ($foo eq '3210abcde') {print "ok 5\n";} else {print "not ok 5 $foo\n";}
45 foreach $foo (("ok 6\n","ok 7\n")) {
51 return $i if $_[0] == $i;
55 print foo(1) == 1 ? "ok" : "not ok", " 8\n";
56 print foo(2) == 2 ? "ok" : "not ok", " 9\n";
57 print foo(5) == 5 ? "ok" : "not ok", " 10\n";
67 print $a == 7 ? "ok" : "not ok", " 11\n";
73 print $loop_count == 4 ? "ok" : "not ok", " 12\n";
75 # modifying arrays in loops is a no-no
77 eval { @a = () for (1,2,@a) };
78 print $@ =~ /Use of freed value in iteration/ ? "ok" : "not ok", " 13\n";
80 # [perl #30061] double destory when same iterator variable (eg $_) used in
81 # DESTROY as used in for loop that triggered the destroy
93 $h{foo} = bless [], 'X';
94 delete $h{foo} for $h{foo}, 1;
95 print $x == 1 ? "ok" : "not ok", " 14 - double destroy, x=$x\n";
98 # [perl #78194] foreach() aliasing op return values
100 print "not " unless \$_ == \$_;
101 print 'ok 15 - [perl \#78194] \$_ == \$_ inside for("$x"){...}',
105 # [perl #123286] Lone C-style for in a block messes up the stack
106 @_ = (1..3, do {for(0;0;){}}, 4..6);
107 print "not " unless "@_" eq '1 2 3 0 4 5 6';
108 print "ok 16 - [perl #78194] Lone C-style for in a block\n";