Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Koosemose's scratchpad

by Koosemose (Pilgrim)
on Dec 31, 2004 at 23:46 UTC ( #418602=scratchpad: print w/ replies, xml ) Need Help??

#!/usr/bin/perl -w use strict; use HTML::Parser 3.00 (); my %inside; my $parser = HTML::Parser->new(api_version => 3, handlers => [start => [\&tag, "tagname, '+1'"], end => [\&tag, "tagname, '-1'"], text => [\&text, "dtext"], ], marked_sections => 1, ); #my ($title, $text)= strip("perl/perlmain.html"); print $title, $tex +t; print strip("perl/perlmain.html"); sub strip { my $text; our $title; $parser->parse_file(shift) || die "Can't open file: $!\n"; #print $title,$text; return $title, $text; } sub tag { my($tag, $num) = @_; $inside{$tag} += $num; #print " "; # not for all tags } sub text { return if $inside{script} || $inside{style}; if ($inside{title}) { $title .= $_[0]; return; } $text .= $_[0]; #print $_[0]; }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2016-07-25 21:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (228 votes). Check out past polls.