Since you have written only two pairs of (capturing) parentheses, you only get two match variables. A quantified capture stores only the string of the last match.
So either make the outer parenthesis capture, and use split to extract the numbers from $1, or write out four pairs of capturing parenthesis.
Note that this is more convenient in Perl 6: a quantified capture records a list of all matches.
In reply to Re: What's wrong with this regex
by moritz
in thread What's wrong with this regex
by bgu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |