Answer by doubleDown for XML reading using Perl
Here's one way with XML::LibXML#!/usr/bin/env perluse strict;use warnings;use XML::LibXML;my $doc = XML::LibXML->load_xml(location => 'data.xml');my @nodes = $doc->findnodes('/xml/date/*');my...
View ArticleAnswer by choroba for XML reading using Perl
Using XML::XSH2, a wrapper around XML::LibXML:#!/usr/bin/perluse warnings;use strict;use XML::XSH2;xsh << '__XSH__'; open 2.xml ; for $t in /xml/date/* { my $s = string($t) ; perl { push @l, $s }...
View ArticleAnswer by Nikhil Jain for XML reading using Perl
Use XML::Simple - Easy API to maintain XML (esp config files) or see XML::Twig - A perl module for processing huge XML documents in tree mode.Example like:use strict;use warnings;use XML::Simple;use...
View ArticleAnswer by Naryl for XML reading using Perl
If you can't/don't want to use any CPAN mod:my @hits= $xml=~/<date\d+>(.+?)<\/date\d+>/This should give you all the dates in the @hits array.If the XML isn't as simple as your example,...
View ArticleXML reading using Perl
I am new to the Perl language. I have an XML like,<xml><date><date1>2012-10-22</date1><date2>2012-10-23</date2></date></xml>I want to parse this XML file...
View Article