1. Search for existing modules
Http://search.cpan.org/
2. Input an XML query and select a module that has a high rating and can meet your needs:
XML: Simple
Use warnings;
Use XML: Simple;
Use Data: Dumper;
# Converting XML files into Hash results
Copy codeThe Code is as follows: my $ xml = XMLin ('abstract _ sample. xml ');
Open (HASH, '> XML_hash') | die "can not open the file: $! ";
Print HASH Dumper ($ xml );
# Obtain the value of a node in XML according to the path defined in XML.
Copy codeThe Code is as follows: print $ xml-> {PubmedArticle}-> {MedlineCitation}-> {PMID };
# You can re-convert XML into a Hash structure to XML output, but note that the converted XML may be different from the external structure of the original XML file.
Copy codeThe Code is as follows: $ MeSH_XML = XMLout ($ xml-> {PubmedArticle}-> {MedlineCitation}-> {MeshHeadingList });
Print $ MeSH_XML;
For more information, see:
Http://search.cpan.org /~ Grantm/XML-Simple-2.18/lib/XML/Simple. pm
XML: Smart
My $ xml = XML: Smart-> new ('abstract _ sample. xml ');
For more information, see:
Http://search.cpan.org /~ Gmpassos/XML-Smart-1.6.9/lib/XML/Smart. pm