Subject: | RegularExpressions::ProhibitUnusedCapture false positive |
This test program:
#!/usr/bin/perl
# $Id $
use warnings;
use strict;
use 5.010;
my $VERSION = 1;
$_ = 'abcabcabc';
pos = 0;
while (pos() < length) {
m{\G(a)(b)(c)}gcxs or die;
my ($a, $b, $c) = ($1, $2, $3);
say "$a $b $c";
}
demonstrably does use the values captured by the regular expression, as
you can see by running it. But perlcritic doesn't see that:
% perlcritic -1 --verbose '%f:%l:%c:%m [%p] (%e)\n' test
test:10:5:Only use a capturing group if you plan to use the captured
value [RegularExpressions::ProhibitUnusedCapture] (See page 252 of PBP)