in reply to replace string

Please take a look at HTML::Entities, it might help you doing what you want in a more general way.