/usr/share/doc/perl-HTML-Parser/eg
NameSizeModeActions
hanchors11960644editdlrm
hbody7290644editdlrm
hdisable7400644editdlrm
hdump7080644editdlrm
hform25020644editdlrm
hlc7170644editdlrm
hrefsub30680644editdlrm
hstrip17670644editdlrm
htext6120644editdlrm
htextsub9360644editdlrm
htitle4610644editdlrm
Edit: /usr/share/doc/perl-HTML-Parser/eg/htext (612B)
#!/usr/bin/perl # Extract all plain text from an HTML file use strict; use warnings; use Encode (); use HTML::Parser (); my %inside; sub tag { my ($tag, $num) = @_; $inside{$tag} += $num; print " "; # not for all tags } sub text { return if $inside{script} || $inside{style}; print encode('utf8', $_[0]); } HTML::Parser->new( api_version => 3, handlers => [ start => [\&tag, "tagname, '+1'"], end => [\&tag, "tagname, '-1'"], text => [\&text, "dtext"], ], marked_sections => 1, )->parse_file(shift) || die "Can't open file: $!\n";