gr.d has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, So I earlier posted a similar unclear question to which I was not able to understand the answer.
I have a STANDARD.XML and I have separated them into two XML files because as a single file, they were inconsistent with the data that I'm trying to parse. Let's say they are TOP.XML and LOWER.XML. Now I'm trying to stores these files in an array and compare them.How can one store the entire file in an array?
By separating the XML files I have tried to fetch the attributes values separately from each of the XML files and write them to a single output file, Now I have to compare the two XML files and declare, (i.e.) Hint:"foreach of the LOWER.XML data, if the data "NOT" present in TOP.XML, then it can be declared as the output or written into that single file"
Does it mean I have to again create another file and write them into that and move it back to original file, if that's how it's written, how to move them to a original file?
My snippet would look something like the below
foreach (<TMP1>) { my $tmp_1 = $_; chomp ($tmp_1); print LOG $gen; foreach (<TMP2>) { my $tmp_2 = $_; chomp($tmp_2); if($tmp_1 ne $tmp_2) { print "wire"; } } }
I'm using XML::Simple part, though he's not the right one, currently I have gone almost the whole way with it, just a little bit more!
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing two XML files with XML::Simple using FOREACH and IF using
by Corion (Patriarch) on Jan 13, 2016 at 08:02 UTC | |
|
Re: Comparing two XML files with XML::Simple using FOREACH and IF using
by mr_ron (Deacon) on Jan 14, 2016 at 16:33 UTC | |
|
Re: Comparing two XML files with XML::Simple using FOREACH and IF using
by anonymized user 468275 (Curate) on Jan 14, 2016 at 14:26 UTC | |
|
Re: Comparing two XML files with XML::Simple using FOREACH and IF using
by Jenda (Abbot) on Jan 21, 2016 at 15:54 UTC |