A quick and dirty approch with XML::Twig (forget xml::simple) and using xml data in Trace On's scratchpad must be a good starting point for your further investigations: each twig's handler is triggered when the specified XPATH is encountered: notice the ugly cur_league workaround..
#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $cur_league='UNKNOWN'; my $t= XML::Twig->new( twig_handlers => { 'league/id' => sub{ $cur_league = $_[1]->te +xt}, 'event/startDateTime'=>sub{ print "$cur_lea +gue,",$_[1]->text,","; }, 'event/homeTeam/name'=>sub{ print $_[1]->te +xt }, 'event/awayTeam/name'=>sub{ print ",",$_[1] +->text,"\n"; } #add more handlers as needed.. } ); $t->parsefile('trace_on.xml'); __OUTPUT__ 1739,2015-06-24T11:59:00Z,Union Mar del Plata,C. Cordoba Santiago 1739,2015-06-08T20:59:00Z,Douglas Haig,Santamarina Tandil 1740,2015-06-30T16:59:00Z,Arsenal de Sarandi,Crucero del Norte 1740,2015-06-14T11:59:00Z,Aldosivi Mar del Plata,Rosario Central 1740,2015-06-14T11:59:00Z,Arsenal de Sarandi,Gimnasia La Plata 1740,2015-06-14T11:59:00Z,Atletico Huracan,Defensa y Justicia 1740,2015-06-14T11:59:00Z,Belgrano de Cordoba,Argentinos Juniors 1740,2015-06-14T11:59:00Z,Estudiantes La Plata,San Martin San Juan 1740,2015-06-14T11:59:00Z,Godoy Cruz Antonio Tomba,Crucero del Norte 1740,2015-06-14T11:59:00Z,Independiente,Olimpo Bahia Blanca 1740,2015-06-14T11:59:00Z,Lanus,Atletico Rafaela 1740,2015-06-14T11:59:00Z,Newells Old Boys,Racing Club 1740,2015-06-14T11:59:00Z,Nueva Chicago BA,Colon de Santa Fe 1740,2015-06-14T11:59:00Z,Quilmes,Banfield 1740,2015-06-14T11:59:00Z,River Plate,Temperley 1740,2015-06-14T11:59:00Z,Sarmiento,Boca Juniors 1740,2015-06-14T11:59:00Z,Union Santa Fe,San Lorenzo 1740,2015-06-14T11:59:00Z,Velez Sarsfield,Club Atletico Tigre 1740,2015-06-08T20:59:00Z,Club Atletico Tigre,Aldosivi Mar del Plata 1740,2015-06-08T23:09:00Z,Defensa y Justicia,Estudiantes La Plata 1756,2015-06-08T10:29:00Z,Bulleen Lions,Brunswick City


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^5: How to parse this hash? XML question (Twig example) by Discipulus
in thread How to parse this hash? And how to describe my probem? by Trace On

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.