>First, $`, $& and $' will be scoped just like $1 and friends. They will
>be set by the regex and be only accessible in the current block or a
>block which starts with a regex like:
>
> if ( /foo/ ) {
Good idea. $`, $&, and $' will be used immediately 99% of the time.
For the rest of the time, the programmer can make copies, just like
with $1, $2, etc.
>But the problem of knowing whether those vars are used by a given regex
>remains. This is solved by a new modifier k (for keep). This tells the
>regex to do the copy so the 3 vars will work properly.
Excellent idea! Simple, neat, doesn't make the language jump through
hoops. The rationale for not making $`, $&, $' smarter has always been
"but we can't tell whether they're ever going to be used, so...".
So fine, the programmer just announces "I'm gonna use them here and
not there".
----------------------------------------------------------------------
Eric J. Roode, [EMAIL PROTECTED] print scalar reverse sort
Senior Software Engineer 'tona ', 'reh', 'ekca', 'lre',
Myxa Corporation '.r', 'h ', 'uj', 'p ', 'ts';