use HTML::TagFilter; # This will strip all HTML from whatever you pass it. my $filter=HTML::TagFilter->new(allow=>{},strip_comments=>1); #fieldvalue appears magically from somewhere; $fieldvalue=$filter->filter($fieldvalue);