/usr/share/doc/libhtml-parser-perl/examples
NameSizeModeActions
hanchors11960755editdlrm
hbody7290755editdlrm
hdisable7400755editdlrm
hdump7080755editdlrm
hform25020755editdlrm
hlc7170755editdlrm
hrefsub30680755editdlrm
hstrip17670755editdlrm
htext6120755editdlrm
htextsub9360755editdlrm
htitle4610755editdlrm
Edit: /usr/share/doc/libhtml-parser-perl/examples/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";