in reply to Repeating a substitution

Well you can use a while $n-- instead of for or use an explicit variable to be processed instead of $_.

But I'd try to use the c modifier, though not sure if it's allowed with s// or restricted to m///

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery