Hello, better you forget XML::Simple, may be you'll instead find useful XML::Twig
In the TIMTOWTDI spirit i present a simple XML::Twig solution:

#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $twig=XML::Twig->new( pretty_print => 'indented', twig_handlers => { 'GfmDocument/GfmHeader/TopicMessageID ' => s +ub{print $_[1]->text,"\n";}, '/GfmDocument/GFMIEDM35/OBJ_ITEM_OO_TBL/OBJ_ +ITEM' => sub{ my $twig = shift; my $obj =shift; print map { "\t".$obj->first_ch +ild_text($_)."\n" } qw(OBJ_ITEM_ID CAT_CODE NAME_TXT); my $org = $obj->first_child('OR +G'); print map { "\t".$org->first_ch +ild_text($_)."\n" } qw(ORG_ID CAT_CODE GFM_CAT_CODE); print "\n\n"; }, }, ); $twig->parsefile( 'xmlpmonks.xml') or die; # build it __END__ #output 2754 72060793789255493 OR Oranization 10 72060793789255493 UN NOS 72060793789255508 OR Organization 25 72060793789255508 UN NOS 72060793789255510 OR Organization 50 72060793789255510 UN NOS
hth

L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Parsing XML with a Twig by Discipulus
in thread Parsing XML by bayareamonk

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.