use HTML::Query; ... my $q = HTML::Query->new( text => $text ); my @nodes = $q->query("li a[title=$title]");