The following code fails in Perl 5.10 to 5.14, but passes in 5.16.
use 5.010;
use strict;
use Test::More tests => 2;
my $string = 'foo bar';
my $regexp = qr{^ (?<word1>\w+) \W+ (?<word2>\w+) $}x;
sub get_words_1
{
if ($string =~ $regexp)
{
my @tmp = @+{qw/ word1 word2 /};
return @tmp;
}
return;
}
sub get_words_2
{
if ($string =~ $regexp)
{
return @+{qw/ word1 word2 /};
}
return;
}
my @expected = qw(foo bar);
my @results1 = get_words_1();
my @results2 = get_words_2();
is_deeply(\@results1, \@expected);
is_deeply(\@results2, \@expected);
Is this apparent bug and bugfix documented anywhere? I can't find any reference to it in perl5160delta.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'