use HTML::Tidy; my $call_dir = "Html3"; my $contents_of_file = 1; #my $tidy = HTML::Tidy->new(); my $tidy = HTML::Tidy->new({ tidy_mark => 1, #output_xhtml => 1, # yes output_html => 1, # yes add_xml_decl => 1, # no wrap => 76, error_file => errs.txt, char_encoding => utf8, indent_cdata => 1 }); #my $tidy = HTML::Tidy->new({config_file => 'config3.txt'}); #my $tidy = HTML::Tidy->new( {config_file => 'path/to/config'} ); my @files = glob "$call_dir/*.html"; printf "Got %d files\n", scalar @files; for my $file (@files) { open my $in_fh, '<', $file or die "Could not open $file : $!"; my $contents_of_file = do { local $/;<$in_fh> }; close $in_fh; $tidy->parse( $file, $contents_of_file ); $tidy->clean( $file); #parse( $filename, $str [, $str...] ) #or warn "Error parsing $file :$!"; for my $message ( $tidy->messages ) { #print $message->as_string; } } #### Aberdeen%20Animal%20trait%20analysis , News Search | Ask.com #### http://www.ask.com/news?q=Aberdeen%2520Animal%2520trait%2520analysis+&qsrc=167&qo=channelNavigation&o=0&l=dir Aberdeen%20Animal%20trait%20analysis , News Search | Ask.com