HTML::TokeParser::Simple is a good HTML parser to get started with and the docs are friendly. :-)

I'm not to sure about your spec but if it is get the text within bold tags that are within td tags then something like this will get you started.

#!/usr/bin/perl use warnings; use strict; use HTML::TokeParser::Simple; my $html = do{local $/;<DATA>}; my $p = HTML::TokeParser::Simple->new(string => $html); my ($in_td, $in_b); while (my $t = $p->get_token) { $in_td++, next if $t->is_start_tag(q{td}); $in_b++, next if $in_td and $t->is_start_tag(q{b}); next unless $in_td and $in_b; if ($t->is_text){ print $t->as_is, qq{\n}; $in_td = 0; $in_b = 0; } } __DATA__ <TR class="violet3"> <TD ><B>hsa-miR-107</B></TD> <TD >17.1922</TD> <TD >-21.47</TD> <TD >2.119850e-02</TD> <TD >2.097540e-02</TD> <TD >6.191350e-04</TD> <TD >106</TD> <TD >127</TD> <TD ><pre><FONT COLOR="#FFFFFF">a</FONT><FONT COLOR="#FFFFFF">c</FON +T><FONT COLOR="#FFFFFF">u</FONT><FONT></FONT> </TR> <TR class="violet2"> <TD ><B>hsa-miR-103</B></TD> <TD >17.1922</TD> <TR class="violet3"> <TD ><B>hsa-miR-651</B></TD> </TR> <TR class="violet2"> <TD ><B>hsa-miR-320</B></TD>
hsa-miR-107 hsa-miR-103 hsa-miR-651 hsa-miR-320
Good luck!

In reply to Re: parsing html by wfsp
in thread parsing html by paola82

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.