Using lexical (my) variables from outside the regex in (?{ ... }) is dangerous. Your code will break if it's moved to a function. Use package (our/use vars) variables instead.
Also, it's unsafe to modify @match at the point where you did modify it. If any backtracking through that the (?{ ... }) that changes @match occurs, you won't get the correct result. Now, the only time your code backtracks is when the match is unsuccessful. Even if you realized that and found it acceptable, you're playing with fire for the smallest change to the regexp can change that.
See earlier post Re: Arbitrary number of captures in a regular expression for the safe approach.
In reply to Re^3: Arbitrary number of captures in a regular expression
by ikegami
in thread Arbitrary number of captures in a regular expression
by grinder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |