more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Anyone who does anything significant with regular expressions learns that the variables $&, $' and $` imposes significant performance penalty on all regular expression matches. I have personally witnessed just how significant the use of these variables can be on performance (KinoSearch & Large Documents). perlvar says under @- the following:
So my question is why can't these variables be implemented this way behind the scenes. If I could get access to the last variable successfully matched against, for instance, I could write a Tie interface for these variables very easy. I am guessing it has to do with keeping track of the last variable matched and handling cases where that variable is changed before reading $& (such as assignment or a s///). This question is really out of curiosity about the internals of the perl regexp engine. Thanks, Ted Young ($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)In reply to Can we make $& better? by TedYoung
|
|