The problem seems to be that you are only looking for the first match (look_down is in scalar context) and are somewhat abusing the parameter processing of look_down to hook out the information you want. The better approach is something like:
use strict;
use warnings;
use HTML::TreeBuilder;
my $p = HTML::TreeBuilder->new;
my @content = <DATA>;
$p->parse_content(@content);
for my $match ($p->look_down('_tag' => 'div', 'class' => 'subsection'
+)) {
my $prop = $match->look_down ('class', 'box_profile_info_small_hea
+ding');
my $value = $match->look_down ('class', 'box_profile_info_small_co
+ntent');
next unless $prop && $value;
print $prop->as_text (), ' => ', $value->as_text (), "\n";
}
which with your sample data prints:
About Me => you will know me better if you want to...
Who I'd Like To Meet => i'd like to meet all the world...
Sexual Orientation => Straight
Drinker => No
Smoker => Socially
Perl is environmentally friendly - it saves trees
|