use strict; use warnings; my $string = <<'HTML'; A > B A > B <# Just data #> >>>>>>>>>>> ]]> HTML $string =~ s/<.+?>//g; print $string;