in reply to Make a Markup Method in Perl?
I know that you could check to see if the tag is around the text easily. It's Regular Expressions of course.
That's the hard way to do it. The easy way to do it is to write a parser to transform text into a data structure, then walk the data structure to transform it into another data structure from which it's easy to emit the right text.
Improve your skills with Modern Perl: the free book.