Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Koosemose's scratchpad

by Koosemose (Pilgrim)
on Dec 31, 2004 at 23:46 UTC ( [id://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
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found