in reply to What's like $+ but not gives the ordinal?
Look at @+ instead (documentation in perlvar). It won't quite do exactly what you want, but you'll at least be able to determine (via defined) whether a given paren matched or not).
Another alternative would be to say
/((?:foo)|(?:bar)|(?:baz))/because then you don't care what matched, you can just refer to $1. If you need to do different things according to what matched, it might just be cleaner to break it up into different regexes, but without more context, it's difficult to say.
Edit: chipmunk 2001-06-27
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: What's like $+ but not gives the ordinal?
by John M. Dlugosz (Monsignor) on Jun 28, 2001 at 01:21 UTC |