First if you're not already using it, I recommend Use strict and warnings, as your code currently has a few uninitialized variables of questionable origin. Next, that modules seems klunky for this purpose, I'd use XML::Rules (I don't print out the same thing as you, since I don't know where you want to get some of what you want):
use strict; use warnings; use XML::Rules; my $xml = <<XML; <FIXML r="20030618" s="20040109" v="4.4" xr="FIA" xv="1"> <Batch> <MktDataFull RptID="13793742" BizDt="2011-12-23"> <Instrmt Sym="MID" MMY="20120317"/> <Full Typ="5" Px="5.303128"/> <Full Typ="D" Px="884.91"/> </MktDataFull> <MktDataFull RptID="14536119" BizDt="2011-12-23"> <Instrmt Sym="MID" MMY="20120218"/> <Full Typ="5" Px="214.007661"/> <Full Typ="D" Px="884.91"/> </MktDataFull> </Batch> </FIXML> XML my @rules = ( MktDataFull => sub { my $data = $_[1]; for my $full (@{$data->{Full}}) { print join(",", @$data{qw(RptID BizDt Sym MMY)}, @$full{qw(Typ P +x)}), "\n"; } return; }, Instrmt => 'pass', Full => 'as array', ); my $xr = XML::Rules->new(rules => \@rules, stripspaces => 3); $xr->parse($xml);

In reply to Re: Issue with looping through XML::LibXML::Reader by runrig
in thread Issue with looping through XML::LibXML::Reader by ozguy

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.