use strict; use warnings; use Time::Piece; use HTML::TagFilter; my $tf = HTML::TagFilter->new(); my $dirty_html = "test252bbgube<"; my $clean_html = $tf->filter($dirty_html); print $clean_html; Current output : test252bbgube< I need : test252bb gube<