This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove full stop in the 'try' feature heading
[perl5.git] / t / op / magic-27839.t
CommitLineData
c4a9334d
NC
1#!./perl -w
2
3BEGIN {
4 $SIG{__WARN__} = sub { die "Dying on warning: ", @_ };
b5efbd1f 5 chdir 't' if -d 't';
c4a9334d 6 require './test.pl';
b30b43eb
FC
7 skip_all_if_miniperl(
8 "no dynamic loading on miniperl, no Tie::Hash::NamedCapture"
9 );
c4a9334d
NC
10}
11
624c42e2
N
12plan(tests => 2);
13
c4a9334d
NC
14use strict;
15
16# Test for bug [perl #27839]
17{
18 my $x;
19 sub f {
20 "abc" =~ /(.)./;
21 $x = "@+";
22 return @+;
23 };
24 "pqrstuvwxyz" =~ /..(....)../; # prime @+ etc in this scope
25 my @y = f();
26 is $x, "@y", "return a magic array ($x) vs (@y)";
27
28 sub f2 {
29 "abc" =~ /(?<foo>.)./;
30 my @h = %+;
31 $x = "@h";
32 return %+;
33 };
34 @y = f();
35 is $x, "@y", "return a magic hash ($x) vs (@y)";
36}
37