use HTML::Parser;
use Symbol;
my $TXT = gensym;
my $parser = HTML::Parser->new(api_version => 3,
text_h => [ sub {
print $TXT @_;
}, "dtext" ]);
for my $html (@ARGV) {
(my $txt = $html) =~ s/\.html$/\.txt/;
open $TXT, ">$txt" or die "Can't open $txt: $!";
$parser->parse_file($html);
close $TXT or die "Can't close $txt: $!";
}
####
% ./foo.pl file1.html file2.html ...