my $lexicon = $doc->find(sub { $_[1]->content eq '%Lexicon' }); $lexicon = $lexicon->[0]; # returns an array ref, but in my case, there's only ever one. #### my $lexicon = $doc->find_first( ... )