in reply to clean html tags

Have you looked at HTML::Entities? That's exactly what it was made to do.