Please take a look at HTML::Entities, it might help you doing what you want in a more general way.
In reply to Re: replace string by moritz in thread replace string by sandy1028