Fix bug [perl #27839] returning @+ out of scope loses its value :
[p5sagit/p5-mst-13.2.git] / t / op / magic.t
index 04cf718..dda07df 100755 (executable)
@@ -36,7 +36,7 @@ sub skip {
     return 1;
 }
 
-print "1..53\n";
+print "1..54\n";
 
 $Is_MSWin32  = $^O eq 'MSWin32';
 $Is_NetWare  = $^O eq 'NetWare';
@@ -411,3 +411,15 @@ ok "@+" eq "10 1 6 10";
     }
     ok $ok;
 }
+
+# Test for bug [perl #27839]
+{
+    my $x;
+    sub f {
+       "abc" =~ /(.)./;
+       $x = "@+";
+       return @+;
+    };
+    my @y = f();
+    ok( $x eq "@y", "return a magic array ($x) vs (@y)" );
+}