![]() |
|
more useful options | |
PerlMonks |
Re: Naughty Regular Expressions and mod_perlby davido (Cardinal) |
on Dec 20, 2003 at 06:31 UTC ( #316003=note: print w/replies, xml ) | Need Help?? |
Modern Perl implementations (v5.6.1 and later, I think) provide the @+ and @- arrays that give information about the position of the last match in strings.
The RegExps, Prematch and Postmatch without efficiency penalty discussion thread provides a solution for using @+ and @- along with either substr or unpack as a means of accomplishing the same thing as $`, $', and $&, but without the performance penalties. I happen to like that node, but I'm biased because I wrote it a few months back. I hope you find it helpful. You will also find information on using these special arrays instead of the $`, $', and $& special variables in perlvar. Good luck! There is a good workaround.
Dave
In Section
Seekers of Perl Wisdom
|
|