Subject: | Variables::ProhibitPunctuationVars - %+ has no English equivalent |
(I am sorry if it has been already reported. I couldn't find it.)
In Perl 5.10 there's a new punctuation variable %+ .
It has no English alias. Maybe it's a bug in perl 5.10 and it should
have an alias, but currently it doesn't.
Perl::Critic identifies its use as "Magic punctuation variable used".
Furthermore, the variable is %+ , but it is usually used with a $ :
$+{capture_name}.
Saying this in .perlcriticrc doesn't help:
[Variables::ProhibitPunctuationVars]
allow = %+
But saying this helps:
[Variables::ProhibitPunctuationVars]
allow = $+
A simple testcase is attached.
Maybe i am missing something and it is the correct behavior. If it is
indeed correct, please document it in the manpage of
Variables::ProhibitPunctuationVars . Thanks.
Thanks in advance.
(Comment: This is perl 5.10 on cygwin and Windows Vista.)
Subject: | test_punct_01.pl |
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
our $VERSION = 0.1;
my $string = 'hello';
if ($string =~ /(?<vowel>[aeiou])/xms) {
say "$string has the vowel ", $+{vowel};
}
else {
say "$string has no vowels";
}
exit;
__END__