http://qs321.pair.com?node_id=764602


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.