# LibXML lingo; XPath expr is off the cuff, untested $doc->findvalue('/section[last()]/title[1]/@num'); #### $doc->root(sub { $_->last_child( 'section', sub { $_->first_child( 'title', sub { $_->att( 'num') }) }) });