##
$input_txt =~ s/\//igs; # remove code
$input_txt =~ s/\<.*?\>//gs; # remove html tags
$input_txt =~ s/\ / /gs; #   -> space
$input_txt =~ s/\s{2,}/ /gs; # Remove extra spaces
print $input_txt;
## ##
not:
Invalid HTML!
####
while( $input_txt =~ s/\<.*?\>//gs ) {};