summaryrefslogtreecommitdiff
path: root/t/cmd.for
diff options
context:
space:
mode:
Diffstat (limited to 't/cmd.for')
-rw-r--r--t/cmd.for28
1 files changed, 26 insertions, 2 deletions
diff --git a/t/cmd.for b/t/cmd.for
index 769bec28bb..6342c89586 100644
--- a/t/cmd.for
+++ b/t/cmd.for
@@ -1,8 +1,8 @@
#!./perl
-# $Header: cmd.for,v 1.0 87/12/18 13:12:05 root Exp $
+# $Header: cmd.for,v 2.0 88/06/05 00:12:19 root Exp $
-print "1..2\n";
+print "1..7\n";
for ($i = 0; $i <= 10; $i++) {
$x[$i] = $i;
@@ -23,3 +23,27 @@ for (;;) {
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;
+}