This looks familiar ... ;)
Have been introduced to Data::Dumper yet? Here is what it makes of the XML 'tree' that is built by XML::Simple:Yields:use Data::Dumper; my $data = do {local $/;<DATA>}; my $xml = XMLin($data); print Dumper $xml;
$VAR1 = {
'label' => 'gene_of_interest',
'id' => '3'
};
From this we see that label and id are the 'top level'
keys, there is no 'gene' key. However, had the XML been
a bit more proper ...
Then all is well. :)use strict; use warnings; use XML::Simple; my $data = do {local $/;<DATA>}; my $xml = XMLin($data); # ... and you use the correct syntax ;) print $xml->{gene}->{id}, "\n"; print $xml->{gene}->{label}, "\n"; __DATA__ <?xml version="1.0" ?> <genes> <gene id = "3" label = "gene_of_interest" /> </genes>
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to (jeffa) Re: XML::Simple
by jeffa
in thread How to access results of XML::Simple?
by matth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |