If I use XML::Twig, this code works if I have 1 'article' element, or 2 or 3 (I didn't try more than 3, but I believe it will work for 100). The output below shows the case with 2 articles (which is your XML example):
use strict; use warnings; use XML::Twig; my $file_in = shift; my $twig= new XML::Twig( twig_handlers => { reference => \&reference } ); $twig->parsefile($file_in); exit; sub reference { my ($twig, $refer) = @_; print $refer->text(), "\n"; } __END__ distdoc:archive/ArchiveDoc::Article/MTPW000020090731e57v004mr distdoc:archive/ArchiveDoc::Article/MTPW000020090731e57v004mr

In reply to Re: Parsing XML: Not an Array/Hash Reference Error by toolic
in thread Parsing XML: Not an Array/Hash Reference Error by leighgable

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.