G'day nathaniels,
I thought I'd draw your attention to the caveats regarding both $` and $'. In perlvar: Variables related to regular expressions, you'll see the same warning for both of these special variables:
"The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches."
The documentation shows alternatives. Do note which Perl versions those alternatives are available in: e.g. @- was added in v5.6.0 while ${^PREMATCH} was added in v5.10.0. And, if you wish, you can use Benchmark to compare them.
-- Ken
In reply to Re: Special Variables and Multiple Regexp Matching
by kcott
in thread Special Variables and Multiple Regexp Matching
by nathaniels
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |