Hi all can anyone tell me i have to extract table and table contents from html using HTML::TableExtract below is my html when i apply tableextract on it ,it is just giving me the 1st column like Organisms, Moleculartype
İt should give me Organism: Human etc. Below is the part of html
<TABLE border="0"><TR valign="top"><td ><TABLE id="RefSNP" cellpadd
+ing="2" width="350" ><TH class="text10" bgcolor="#ccccff" align="cen
+ter" colspan="2">RefSNP</TH><TR ><td class="text10" bgcolor="#f1f1f1
+" align="right"><strong>Organism:</strong></td><td class="text10" bg
+color="#f1f1f1">human (<a href="http://www.ncbi.nlm.nih.gov/Taxonomy/
+Browser/wwwtax.cgi?mode=Info&id=9606"><em>Homo sapiens</em></a>)</td>
+</TR><TR
use HTML::TableExtract;
my $te = HTML::TableExtract->new(
keep_html=>1,
headers =>[qw(RefSNP)]);
my $file = "Reference SNP(refSNP) Cluster Report rs111.htm";
my $document = do {
local $/ = undef;
open my $fh, "<", $file
or die "could not open $file: $!";
<$fh>;
};
$te->parse( $document);
for my $ts($te->tables)
{
print "Table(",join(',',$ts->coords),":\n";
for my $row ($ts->rows)
{
for my $cell (@$row)
{
next unless $cell;
$cell =~ s/<\/B> //i;
print $cell."\n";
}
}
}
This is my code kindly plz anybody help
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.