Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Finding the right $<*digit*> capture variable

by Enlil (Parson)
on Apr 15, 2003 at 22:34 UTC ( [id://250715]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-19 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found