return $ok;
}
-print "1..50\n";
+print "1..54\n";
# Test do &sub and proper @_ handling.
$_[0] = 0;
ok("@x" eq "24 25 26 27", 'if (0){} else { ...; @a } receives caller list context');
+# [perl #38809]
+@a = (7, 8);
+$x = sub { do { return do { 1; @a } }; 3 }->();
+ok(defined $x && $x == 2, 'return do { } receives caller scalar context');
+@x = sub { do { return do { 1; @a } }; 3 }->();
+ok("@x" eq "7 8", 'return do { } receives caller list context');
+@a = (7, 8, 9);
+$x = sub { do { do { 1; return @a } }; 4 }->();
+ok(defined $x && $x == 3, 'do { return } receives caller scalar context');
+@x = sub { do { do { 1; return @a } }; 4 }->();
+ok("@x" eq "7 8 9", 'do { return } receives caller list context');
+
END {
1 while unlink("$$.16", "$$.17", "$$.18");
}