in reply to Finding the right $<*digit*> capture variable

I don't know where you are going with this but the $^N variable, but it might be what you are looking for (granted I am aware that it does not get you the number). According to perlvar:

This is primarily used inside (?{...}) blocks for examining text recently matched. For example, to effectively capture text to a variable (in addition to $1, $2, etc.), replace (...) with

(?:(...)(?{ $var = $^N }))
By setting and then using $var in this way relieves you from having to worry about exactly which numbered set of parentheses they are.

-enlil

Replies are listed 'Best First'.
Re: Re: Finding the right $<*digit*> capture variable
by diotalevi (Canon) on Apr 16, 2003 at 05:01 UTC

    Not only is $^N specific to >=5.8.0 it doesn't provide any information regarding which numbered variable it refers to. Thank you though.