Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-12-26 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls