in reply to Modifying the match position after each match
Two suggestions based on discussion from CB:
while ($string =~ qr(...)) { $string = qq($1'$2); }
and
$string = join('_', map { ( $_ && ( $_ !~ qr(') ) ) ? qq('$_) : $_ } split( q{_}, $string ) );
The first, I think, is O(N^2), and the second is O(N), so depending on string size, data set size, etc, the choice might make a difference.
My wife is walking for a cure for MS. Please consider supporting her.
|
|---|