zing has asked for the wisdom of the Perl Monks concerning the following question:
Hi all.
I have this xml file :-
http://www.genome.jp/kegg-bin/download?entry=pon01100&format=kgml
I even tried parsing it with XML:Simple as :-
use strict; use XML::Simple; use Data::Dumper; my $xml_hash = XMLin('pon01100.xml'); print Dumper($xml_hash);
Its dumping the output as desired to the console.
What I want to do is for each of reactions (named rn:....) I want the substrate "id" and its corresponding all product "id". There could be cases when there would be two or more products for a substrate. For each of the reactions ,I want to save "substrate id" and all its corresponding "product id". Please help$VAR1 = { 'reaction' => { 'rn:R07892' => { 'substrate' => { 'name' => 'cpd:C +16331', 'id' => '3038' }, 'type' => 'reversible', 'id' => '983', 'product' => { 'name' => 'cpd:C16 +332', 'id' => '2201' } }, 'rn:R02687' => { 'substrate' => { 'name' => 'cpd:C +00641', 'id' => '3607' }, 'type' => 'reversible', 'id' => '3606', 'product' => { 'name' => 'cpd:C01 +885', 'id' => '3608' } }, 'rn:R05640' => { 'substrate' => { 'name' => 'cpd:C +01724', 'id' => '2269' }, 'type' => 'reversible', 'id' => '651', 'product' => { 'name' => 'cpd:C11 +455', 'id' => '2270' } }......and so on......
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Parsing an XML file
by aitap (Curate) on Aug 24, 2012 at 12:16 UTC | |
Re: Parsing an XML file
by blue_cowdawg (Monsignor) on Aug 24, 2012 at 11:43 UTC | |
Re: Parsing an XML file
by Jenda (Abbot) on Aug 27, 2012 at 17:18 UTC | |
Re: Parsing an XML file
by runrig (Abbot) on Aug 24, 2012 at 16:13 UTC |
Back to
Seekers of Perl Wisdom