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.
#!/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);
And my data dump looks like this.
$VAR1 = { 'sas_residue_annotation' => [ { 'xmlns' => 'http://www.ebi.a +c.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 ...
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.

In reply to request for help on working with XML::Simple by Angharad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.