perlquestion
Angharad
I'm currently learning how to work with xml documents. I've got as far as finding out about XML::Simple and working though some examples. Here is my 'test script' as it is at the moment.
<code>
#!/usr/bin/perl
# use module
use XML::Simple;
use Data::Dumper;
$xs = new XML::Simple(keeproot => 1,searchpath => ".",
forcearray => 1,);
$ref = $xs->XMLin("test.xml");
print Dumper($ref);
</code>
And my data dump looks like this.
<code>
$VAR1 = {
'sas_residue_annotation' => [
{
'xmlns' => 'http://www.ebi.ac.uk/WSsas/Schema',
'sources' => [
{
'source' => [
{
'source_name' => [
'1iho'
],
'ref_evalue' => [
'5.5e-50'
],
'ref_overlap' => [
'282'
],
'ref_identity' => [
'47.20'
],
'ref_pmid' => [
'11377204'
]
},
{
'source_name' => [
'1mop'
],
'ref_evalue' => [
'8.3e-38'
],
'ref_overlap' => [
'264'
],
'ref_identity' => [
'43.60'
],
'ref_pmid' => [
'12717031'
]
},
{
'source_name' => [
'1n2b'
],
'ref_evalue' => [
'8.2e-38'
],
'ref_overlap' => [
'264'
],
'ref_identity' => [
'43.60'
],
'ref_pmid' => [
'12717031'
]
},
etc ...
</code>
I'm not sure how to go about retrieving the information - how I might, for example, just want to print off all the 'source names' in my file. I've tried following a few examples on this today and haven't been able to figure it out yet.
Any tips much appreciated.