scalar @+ always returns the number of paren groups in the RE, regardless of which one matched. Checking defined on the elements is really no different from doing it with the vars directly, but I see the advantage is being able to use a loop with subscripts.
I can't break it up into different regex's because replacing doesn't have the /G and one-at-a-time feature that just searching does.
—John
Comment on Re: Re: What's like $+ but not gives the ordinal?