Dear Monks!
I'm playing with html-parsing (using HTML::Tree), and am stuck with parsing the following snippet:
<span class="name color1">ImportantText1</span>
<span class="name color2"><span class="level">1000</span>ImportantText
+2</span>
I try to parse this with the code below (just a part of the script to show you the idea), and finally want to have the
ImportantText1 or
ImportantText2 in the variable
$name. However I end with the value
1000ImportantText2
in the second case. And somehow I cannot find the part of the documentation which shows me
how to replace the
as_trimmed_text() so the values of the sub-elements are ignored.
Please enlighten me!
Rata
my @subsub = $body->look_down (_tag => "span");
foreach my $sss (@subsub) {
my $c = $sss->attr("class");
if ($c =~ /name color/) { $name = $sss->as_trimmed_text(); }
}