Vanquish has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTML::Parser; # Create instance my $p = HTML::Parser->new(api_version => 3, marked_sections => 1, unbroken_text => 1, start_h => [\&start_rtn, 'tag','event'], text_h => [\&text_rtn, 'text'], end_h => [\&end_rtn, 'tag']); # Start parsing the following HTML file $p->parse_file("testpage.html"); sub start{ # Execute when start tag is encountered my ($tag, $text, $event) = @_; if ($tag =~ /td/){ print "\t$text \n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML Parser print text
by Joost (Canon) on Jul 07, 2004 at 21:01 UTC | |
by Vanquish (Novice) on Jul 07, 2004 at 21:13 UTC | |
by Joost (Canon) on Jul 07, 2004 at 21:16 UTC | |
|
Re: HTML Parser print text
by Joost (Canon) on Jul 07, 2004 at 18:14 UTC | |
by Anonymous Monk on Jul 07, 2004 at 19:20 UTC | |
by Joost (Canon) on Jul 07, 2004 at 19:29 UTC | |
by Anonymous Monk on Jul 07, 2004 at 20:13 UTC |