use YAPE::HTML;
use strict;
my ($some_html,$p,$ext) = ("...");
$p = YAPE::HTML->new($some_html);
$ext = $p->extract(a => ['href'], img => ['src']);
while (my $tag = $ext->()) {
# an tag with an HREF attribute, or
# an
tag with an SRC attribute
}
$ext = $p->extract(qr/^h[1-3]$/ => []);
while (my $tag = $ext->()) {
# an , , or
}