Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 chilling in the Monastery: (9)
As of 2014-09-30 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (385 votes), past polls