my @anchors = $t->look_down(_tag => q{a});
my @hrefs;
for my $anchor (@anchors){
if ($anchor->as_text eq q{NEXRAD Level III}){
push @hrefs, $anchor->attr(q{href});
$anchor->replace_with_content;
}
}
print qq{$_\n} for @hrefs;
HAS.FileAppSelect?datasetname=7000
An href is attribute of an HTML element, hence $anchor->attr(q{href}) :-)
Have a look at the HTML::Element docs to see what the look_down, as_text, attr and replace_with_content methods do.
update
heh! Looking back at your original question I saw
I want to remove the href...
and I read that as removing the anchor tag from the HTML. :-)
Did you mean you wanted to get/extract the hrefs and store them in an array? If so you don't need the
$anchor->replace_with_content;
line. I'll get there in the end. :-)
|