#!/usr/bin/perl

my ($file, $incomment);
use strict;

$file = shift || die "Pass me a file!\n";

open (FOO, $file) || die "Can't read $file $!\n";
while (<FOO>) {
	if ($incomment) {
		if (s/^.*?-->//) { # ending comment 
			$incomment = 0;
			redo;
		}
		next; # entire line is a comment
	}
	s/<!--.*?-->//g; # comment on one line
	if (s/<!--.*//) {
		$incomment = 1;
		print unless (/^\s*$/); # maybe some stuff before
		next;
	}
	print unless (/^\s*$/);
}
close FOO;

