while ($content =~ m!($code_regex)!go) { my $match = $1; $content =~ s!$match!$match$href1$i$href2!; $i++; }
You can't use m//g in a scalar context when you are modifying the string you are matching against between scalar m//g's. I bet the $content =~ s!!! is resetting pos($content) to 0 each time, causing the infinite loop. The random order of matching is probably the debugger trying but not succeeding to restore complex regex context. In this case, debug with print statements. ):
- tye (but my friends call me "Tye")In reply to Re: Perlmonks Code Proxy
by tye
in thread Perlmonks Code Proxy
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |