vit has asked for the wisdom of the Perl Monks concerning the following question:
It works pretty good but returns JavaScript code at the end. How can I get rid of it?#!/usr/bin/perl use strict; use warnings; my $the_file; use LWP::Simple; #$the_file = get("http://www.perlmonks.org"); # or $the_file = get("http://search.yahoo.com/search?p=hotel&fr=yfp-t-103&t +oggle=1&cop=mss&ei=UTF-8"); use HTML::Parser; my $parser = HTML::Parser->new( text_h => [ \&text_handler,"self,dtext +" ], start_document_h => [\&init, "self"] ); $parser->parse($the_file); print @{$parser->{_private}->{text}}; sub init { my ( $self ) = @_; $self->{_private}->{text} = []; } sub text_handler { my ( $self, $text) = @_; push @{$self->{_private}->{text}}, $text; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Parser, get rid of JavaScript
by pc88mxer (Vicar) on Jun 25, 2008 at 00:49 UTC | |
|
Re: HTML::Parser, get rid of JavaScript
by Anonymous Monk on Jun 25, 2008 at 05:47 UTC | |
|
Re: HTML::Parser, get rid of JavaScript
by tachyon-II (Chaplain) on Jun 25, 2008 at 14:24 UTC | |
by moritz (Cardinal) on Jun 25, 2008 at 14:56 UTC | |
by tachyon-II (Chaplain) on Jun 25, 2008 at 16:26 UTC |