I'm also not sure I entirely understand the problem, but here's another possible (?) approach:
c:\@Work\Perl\monks>perl -wMstrict -le
"use 5.010;
;;
use warnings;
use strict;
;;
use Test::More 'no_plan';
use Test::NoWarnings;
;;
my @vectors = (
[ 'Value:', '[]' ],
[ 'Value:.', '[][]' ],
[ 'Value:...', '[][][][]' ],
[ 'Value:A', '[A]' ],
[ 'Value:A.B', '[A][B]' ],
[ 'Value:.A', '[][A]' ],
[ 'Value:A.', '[A][]' ],
);
;;
VECTOR:
for my $ar_vector (@vectors) {
my ($str, $expected) = @$ar_vector;
;;
my $converted =
join '',
map qq{[$_]},
$str =~ m{ (?: Value: | [.]) \K [^.]* (?= [.] | \z) }xmsg;
;;
is $converted, $expected, qq{'$str' -> '$converted'}
}
"
ok 1 - 'Value:' -> '[]'
ok 2 - 'Value:.' -> '[][]'
ok 3 - 'Value:...' -> '[][][][]'
ok 4 - 'Value:A' -> '[A]'
ok 5 - 'Value:A.B' -> '[A][B]'
ok 6 - 'Value:.A' -> '[][A]'
ok 7 - 'Value:A.' -> '[A][]'
ok 8 - no warnings
1..8
Give a man a fish: <%-{-{-{-<