What about this script? HTML::Parser

D

Danny

Thanks Bob for getting me started.

Here is a bit of code. This works and prints out the text of an HTML doc.

How can I modify this so I can see the tags too. I tried some examples, but
could not get it to work.
I would like to extract the skunumber out too in these kinds of statemens in
the index.html
<INPUT type=hidden value=item34443 name=skunumber>

Here is code:
---------------------------
#!/usr/bin/perl -w

package Example;

use strict;

require HTML::parser;

@Example::ISA = qw(HTML::parser);

my $parser = Example->new;

$parser->parse_file('index.html');

print $parser->{TEXT};


sub text
{
my ($self,$text) = @_;
$self->{TEXT} .= $text;
}
 
T

Tad McClellan

Danny said:
How can I modify this so I can see the tags too. I tried some examples, but
could not get it to work.


Show us what you tried and we will help you fix it.
 
D

Danny

Tad McClellan said:
Show us what you tried and we will help you fix it.

Hello Tad

My previous post has the script to try out. I ran this and it works fine on
any html but I would like to extract out the tags and such. What do you
think?

Thanks
 
J

Joe Smith

Danny said:
My previous post has the script to try out. I ran this and it works fine on
any html but I would like to extract out the tags and such. What do you
think?

Your previous example has a handler for 'text' and prints {TEXT}.
There is no handler for 'input' and does not print {INPUT}.

Show us where an example where you actually try to process <INPUT ...>.
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top