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.
In reply to Re^2: Impact of special variables on regex match performance
by JavaFan
in thread Impact of special variables on regex match performance
by roubi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |