in reply to What's like $+ but not gives the ordinal?
Or you could do:if ($string =~ /(foo(?{ $N = 1 }))|(bar(?{ $N = 1 }))/) { if ($N == 1) { ... } else { ... } }
Since I seem to be (becoming) the regcomp.c pumpking, I'll see if I could kludge something together.if (my @capt = $string =~ /(foo)|(bar)/) { $N = @capt; for (reverse @capt) { last if defined; $N--; } if ($N == 1) { ... } else { ... } }
|
|---|
| 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:15 UTC |