|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Functions in substitutions (s///) and Perl 5.8.by v_thunder (Scribe) |
| on Oct 23, 2002 at 19:59 UTC ( #207511=perlquestion: print w/ replies, xml ) | Need Help?? |
|
v_thunder has asked for the
wisdom of the Perl Monks concerning the following question:
Dear Monks, I have some code that does this:
Where $helper is an anonymous function that returns the text to be substituted. This works great with perl 5.6, but breaks in 5.8 with:
I'm not sure what the problem is, I've also tried:
which fails in the same way. I briefly thought about doing something sort of like:
But the problem with that (besides it being inefficient) is that m// and s/// seem to use the same pointer to mark where in the string the last search ended--so the substitution changes the *next* occurrence of the pattern, not the one the m// matched. So I'd like to know:
I await enlightenment :-) -Dan
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||