in reply to Return value from positive look behind

Another example of the effect of what you were doing in the OP (i.e., a non-zero-width capture within a zero-width assertion):

Win8 Strawberry 5.8.9.5 (32) Wed 11/11/2020 18:02:18 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my $s = 'ABCDE'; while ($s =~ m{ (?= (\w+)) }xmsg) { print $1; }; ^Z ABCDE BCDE CDE DE E
A useful trick when you want overlapping captures.

Update: This might be a better example of overlapping capture:

Win8 Strawberry 5.8.9.5 (32) Wed 11/11/2020 21:41:12 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my $s = 'ABCDE X YZ FGHI'; while ($s =~ m{ (?= (\w{3})) }xmsg) { print "'$1'"; }; ^Z 'ABC' 'BCD' 'CDE' 'FGH' 'GHI'


Give a man a fish:  <%-{-{-{-<