use XTM; use XTM::AsTMa; my $tm = new XTM (tie => new XTM::AsTMa (file => 'beers-r-us.atm')); use XTM::Path; my $xtmp = new XTM::Path (default => $tm); my @beers = $xtmp->find('topic[instanceOf/topicRef/@href = "#beer-brand"]'); foreach my $topic (@beers) { my @basenames = $xtmp->find('baseNameString/text()', $topic); my @occurrences = $xtmp->find('occurrence/resourceRef/@href', $topic); print qq{$basenames[0]\n}; } use Data::Dumper; foreach my $name (qw(BudWeiser)) { my @bn = $xtmp->find (qq{topic[baseNameString = "$name"]}, $tm); print Dumper \@bn; } foreach my $name (qw(BudWeiser)) { my @bn = $xtmp->find ('topic[baseNameString = ?name]', $tm, { name => $name }); print Dumper \@bn; }