in reply to Impact of special variables on regex match performance

There are much better ways to do what these variables do.   They were, I think, “an idea that seemed to be a good idea to somebody at some time.”   They aren’t unsupported, but I would consider them effectively deprecated.

Replies are listed 'Best First'.
Re^2: Impact of special variables on regex match performance
by JavaFan (Canon) on Dec 09, 2010 at 21:54 UTC
    $' and friends aren't deprecated. Deprecation means it's marked as "may disappear from the language".

    Furthermore, $' and friends aren't bad. They are very convenient. They come with a price - there's a performance impact. But we're willing to pay a huge performance impact on picking Perl over C, because Perl is much more convenient. It's the same with $' and friends. I use them a lot. Not for long running programs that possible do thousands of matches on long strings, but I write a lot of programs whose running time is I/O bound, and which do just a handful of matches against short strings. I use $' and $` in those.

    It's just silly to consider $' and friends as evil. As a child, everything is black and white. Things are good, or evil. As a programmer, you do not have that luxery. Only a few constructs or techniques are really evil or very good. Everything else is a tradeoff. Good programmers aren't judged by what they know - but how they do their trade-offs.