p4raw-id: //depot/perl@1789
#define POPLOOP2() \
SvREFCNT_dec(cxloop.iterlval); \
if (cxloop.itervar) { \
- SvREFCNT_dec(*cxloop.itervar); \
+ sv_2mortal(*cxloop.itervar); \
*cxloop.itervar = cxloop.itersave; \
} \
if (cxloop.iterary && cxloop.iterary != PL_curstack) \
#!./perl
-# $RCSfile: for.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:09 $
-
-print "1..7\n";
+print "1..10\n";
for ($i = 0; $i <= 10; $i++) {
$x[$i] = $i;
foreach $foo (("ok 6\n","ok 7\n")) {
print $foo;
}
+
+sub foo {
+ for $i (1..5) {
+ return $i if $_[0] == $i;
+ }
+}
+
+print foo(1) == 1 ? "ok" : "not ok", " 8\n";
+print foo(2) == 2 ? "ok" : "not ok", " 9\n";
+print foo(5) == 5 ? "ok" : "not ok", " 10\n";