undef $/; my $html = ; $html =~ s/<.+?>//sg; #strips all HTML, in a quick'n'dirty way $html =~ s/\s+/ /sg; #normalizes whitespace