in reply to regex substitution

I know "want to solve this with a regex", but I definitely think you may want to look at Text::Template -- there is an example in the documentation that is -very- similiar to what it seems you are trying to accomplish (the apparent goal, not the regex solution necessarily).

--
notsoevil
--
Jeremiah 49:32 - And their camels shall be a booty. . .