http://qs321.pair.com?node_id=218634

matth has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

The code shown in Re: Removing duplicate subtrees from XML works very well with the data shown in this posting. But with my data (as below)

<species name = "hs"> <sequence id = "1" title = "chromosome 1"> <genome_feature type = "CDS"> <gene id = "01"> <gene_seq number = "1"></gene_seq> </gene> </genome_feature> </sequence> </species> <species name = "hs"> <sequence id = "1" title = "chromosome 1"> <genome_feature type = "CDS"> <gene id = "17"> <gene_seq number = "2"></gene_seq> </gene> </genome_feature> </sequence> </species>
I get the following error messages:
bash-2.05$ perl perl_monks_F.pl sorted doc generation NOK: expected: <species name = "hs"> <sequence id = "1" title = "chromosome 1"> <genome_feature type = "CDS"> <gene id = "17"> <gene_seq number = "2"></gene_seq> </gene> </genome_feature> </sequence> </species> found: <species name="hs"> <sequence id="1" title="chromosome 1"> <genome_feature type="CDS"> <gene id="01"> <gene_seq number="1"></gene_seq> </gene> </genome_feature> </sequence> </species> Use of uninitialized value in substitution (s///) at perl_monks_F.pl l +ine 143, <DATA> chunk 2. Use of uninitialized value in substitution (s///) at perl_monks_F.pl l +ine 144, <DATA> chunk 2. Use of uninitialized value in substitution (s///) at perl_monks_F.pl l +ine 145, <DATA> chunk 2. Use of uninitialized value in string eq at perl_monks_F.pl line 50, <D +ATA> chunk 2. Use of uninitialized value in concatenation (.) or string at perl_monk +s_F.pl line 56, <DATA> chunk 2. merged doc generation NOK: expected: found: <species name="hs"> <sequence id="1" title="chromosome 1"> <genome_feature type="CDS"> <gene id="01"> <gene_seq number="1"></gene_seq> </gene> </genome_feature> </sequence> </species> bash-2.05$

Alterations that I made to the provided script were the addition of a few ErrorContext => 1 statements. And I have tested these slight alterations with the data used in the top posting link.