There are several ways to do it.
As we've gotten rid of a lot of crap by only using one line of the original html, you could use a regular expression here, but that is in general not a good idea for decomposing html.
Personally I like HTML::TreeBuilder::XPath that you would have to install from CPAN.
Here is how you would then extract the name from one of the files with it:
As you can see you simply use an xpath-expression to indentify the node you want.use strict; use HTML::TreeBuilder::XPath; my $tree = HTML::TreeBuilder::XPath->new; #use real file name here open(my $fh, "<", "file.html") or die $!; $tree->parse_file($fh); my ($name) = $tree->findnodes(qq{/html/body/table/tr[1]/td[2]}); print $name->as_text;
So how to determine that?
I use a Firefox-plugin called XPather, that allows you to simply click on a html-element and extract the corresponding xpath.
So you load the file you want to parse in Firefox, click on the stuff you want, get the xpath and use that in the perl-script.
Hope that gets you started...
In reply to Re^3: HTML-Parser: a newbie question: need to extract exactly line 999 out of 5000 files..
by morgon
in thread HTML-Parser: a newbie question: need to extract exactly line 999 out of 5000 files..
by Perlbeginner1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |