in reply to inserting into html files

I think you need to use less escaping!

There are all kinds of things in that regex that don't need to be there.

You don't need to escape the slashes if you don't use slash as the delimiter:s|foo|bar|, s#foo#bar#, s{foo}{bar} for instance.

You also don't need brackets around either side, or to escape the double quotes inside the single-quotes, so instead of

s/(<head>)/(<head><meta http-equiv=\"Content-Type\" content=\"text\/html; charset=ISO-8859-1\"\/>)/gi
you could just use:
s|<head>|<head><meta http-equiv="Content-Type" content="text\/html; charset=ISO-8859-1" />|gi

The above works for me.



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print