I've edited the code to a simpler test case:
use strict; use warnings; use HTML::TreeBuilder; my $p=HTML::TreeBuilder->new; my @content = <DATA>; $p->parse_content(@content); $p->look_down( '_tag' =>'div', 'class' =>'subsection', sub { my $property; my $value; $_[0]->look_down('class', 'box_profile_info_small_heading',sub + {$property = $_[0]->as_text}); $_[0]->look_down('class', 'box_profile_info_small_content',sub + {$value = $_[0]->as_text}); warn "$property => $value" if $property; } ); $p->delete; __DATA__ <html> <body> <div class="subsection"> <table width="100%" cellpadding="0px" cellspacing="0px"><tr><td> <h4 class="box_profile_info_small_heading"> About Me </h4> <div class="box_profile_info_small_content"> you will know me better if you want to... </div> </td></tr></table> </div> <div class="subsection-separator"></div> <div class="subsection"> <table width="100%" cellpadding="0px" cellspacing="0px"><tr><td> <h4 class="box_profile_info_small_heading"> Who I&#39;d Like To Meet </h4> <div class="box_profile_info_small_content"> i&#39;d like to meet all the world... </div> </td></tr></table> </div> <div class="subsection-separator"></div> <div class="subsection"> <table width="100%" cellpadding="0px" cellspacing="0px"><tr><td> <h4 class="box_profile_info_small_heading"> Sexual Orientation </h4> <div class="box_profile_info_small_content"> Straight </div> </td></tr></table> </div> <div class="subsection-separator"></div> <div class="subsection"> <table width="100%" cellpadding="0px" cellspacing="0px"><tr><td> <h4 class="box_profile_info_small_heading"> Drinker </h4> <div class="box_profile_info_small_content"> No </div> </td></tr></table> </div> <div class="subsection-separator"></div> <div class="subsection"> <table width="100%" cellpadding="0px" cellspacing="0px"><tr><td> <h4 class="box_profile_info_small_heading"> Smoker </h4> <div class="box_profile_info_small_content"> Socially </div> </td></tr></table> </div> <div class="subsection-separator"></div> <div class="section" id="background"> <h1 class="bg_title box_profile_info_large_heading">Background</h1> <div class="info-box"> <h4 class="box_profile_info_small_heading"> Ethnicity </h4> <div class="box_profile_info_small_content"> White/Caucasian </div> </div> <div class="info-box"> <h4 class="box_profile_info_small_heading"> Religion </h4> <div class="box_profile_info_small_content"> Christian - Other </div> </div> </body> </html>

In reply to Re^2: html::treebuilder problem by spx2
in thread html::treebuilder problem by spx2

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.