You can see the full documentation at http://search.cpan.org/author/GAAS/HTML-Parser-3.26/lib/HTML/LinkExtor.pm if you want to, but I'm just wondering what prompted the author to return the results as an array with a hash as the second item?
Here's the relevant section:
$p->links Returns a list of all links found in the document. The returned values will be anonymous arrays with the follwing [sic] elements: [$tag, $attr => $url1, $attr2 => $url2,...]
It's kind of confusing me. For a start, if it's a hash, shouldn't that be
instead?[$tag, {$attr => $url1, $attr2 => $url2,...}]
And more to the point, I'm racking my not-inconsiderable knowledge of HTML to try and find a situation where a single tag could have two or more attributes which were links.
Apart from anything else, this structure leads to scary dereferencing being needed like this:
$p = HTML::LinkExtor->new(\&cb, "http://www.perl.org/"); sub cb { my($tag, %links) = @_; print "$tag @{[%links]}\n"; }
Maybe
isn't scary to you but it is to me...@{[%links]}
($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |