There are some ready bio-informatics tools and even perl modules.
However, this kind of problem of multiple replaces in text is quite easy to achieve with the Mark feature of tcl/tk text widgets, which should hopefully be available in the tcl/tk perl module. The Marks are like bookmarks within text, and they automatically move as you insert/replace text.