On Thu, Aug 31, 2000 at 12:52:23PM -0400, Joe McMahon wrote:
>
> /($pat1)($pat2)($pat3)(?{sub1(@\)$pat4|?{sub2(@\)}$pat5|?{sub3(@\)})/
>
> This would translate to "if pat1pat2pat3 matches, call sub1 with all the
> matches to that point if pat4 matches afterward, otherwise call sub2
> with all the matches if pat5 matches, else just call sub3." The key bit
> here is that you pass over the sub call, deferring it until you've
> decided if the whole match worked, then picking the one that succeeded
> and calling it. If you don't like the syntax, please feel free to
> propose another.
Hmm... Isn't that just equivalent to this (expanded for readability):
/
($pat1)($pat2)($pat3)
(?:
$pat4(?{sub1($1,$2,$3)}) |
$pat5(?{sub2($1,$2,$3)}) |
(?{sub3($1,$2,$3)})
)
/x;
?
If so, all we're missing is @\
> @\ seemed a good mnemonic for "the array of backreferences I already
> matched".
Yes, it does.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]