perldoc perlre: (?<NAME>pattern) A named capture buffer. Identical in every respect to normal capturing parentheses () but for the additional fact that %+ or %- may be used after a successful match to refer to a named buffer. Inside (?|pattern) the "branch reset" pattern, the capture buffers are numbered from the same starting point in each alternation branch. Apparently the branch reset pattern is implemented by aliasing the capture buffers in the alternate branches to each other, and this aliasing also happens with the named capture buffers, causing buffers which would be separate inside (?:pat) to be aliases for the same buffer inside (?|pat). possible paths forward: 1: document that using named capture buffers within the branch reset pattern is inadvisable, possibly including issuing an optional runtime warning 2: modify the branch reset pattern to respect the uniqueness of named capture buffers, by introducing yet another additional level of indirection, deferring the assignment of captured values into named and numbered buffers until afterwards, in a new "renumbering step", instead of aliasing the buffers in advance (which must be what currently happens.) 3: make use of a named capture buffer within a branch reset pattern a fatal compile-time error 4: ? -- intake, compression, power, exhaust, repeat.Thread Next