in reply to Why can't $` $& $' be enabled on a per-regex basis?

They're globals, so local has an influence:

perl -e'$_="fafbfc";/fc/;{local $`;/bf/;print $`,$/} print $`, $/'
prints:
faf
fafb

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Why can't $` $& $' be enabled on a per-regex basis?
by Courage (Parson) on Aug 10, 2002 at 06:45 UTC
    Actually the point of a question was trying to invent a way to optionally provide those variables on demand, and not how it is done now - once seen in a script, those variables are provided for every regex, thus slowing program down significantly.

    That question sometimes arise on p5p, and, as I remember, an answer is probably because all bits for modifiers are occupied, and there is no way to add another one without enlarging corresponding C struct.

    Courage, the Cowardly Dog