#With $_ holding the HTML text... #Pull comments. Note that # ` bar <--" -->' will NOT strip ` bar '. # I claim this to be a feature. s///g; #for comments like , # strip from after the start of the tag up to the end # of the first quoted string, repeatedly, ending in either # `<>' or `' # Update: Now handles either quote char, with the other # possibly within the quoted string. while ( s/<(?!--)[^'">]*"[^"]*"/]*'[^']*'/]*>//g; print $_;