- or download this
<a
href
...
<a href=http://www.example.com/7>Se<span
>ve</span>n</a>
<script>/* --> */</script>
- or download this
<script type="text/javascript">/*<![CDATA[
</script>
...
<![CDATA[
<a href="http://www.example.com/8">Eight</a>
]]>
- or download this
use Mojo::DOM;
my $links = Mojo::DOM->new($html)->find('a[href]');
...
( my $txt_trim = $link->all_text ) =~ s/^\s+|\s+$//g;
print $link->{href}, "\t", $txt_trim, "\n";
}
- or download this
use HTML::TreeBuilder::XPath;
my $p = HTML::TreeBuilder::XPath->new;
...
for my $link (@links) {
print $link->attr('href'), "\t", $link->as_text_trimmed, "\n";
}
- or download this
use HTML::LinkExtor;
my $p = HTML::LinkExtor->new;
...
my ($tag, %attrs) = @$link;
print $attrs{href}, "\n";
}