What exactly do you mean by that? Can you post a shortened example of what you want the structure to look like?

Based on a best guess of what you meant I changed my code to look like:

#!/usr/bin/perl -w use strict; use XML::Simple; use Data::Dumper; my $stuff=XMLin(undef,KeyAttr=>['server']); print Dumper($stuff);
which then takes the server element and treats everything enclosed by that as an array. Is that what you were after? Short sample of the structure:
$VAR1 = { 'server' => [ { 'location' => 'atlanta', 'name' => 'cns04-fs16', 'event' => { 'sparedata' => 'Disk on cns04-fs16 +at WARNING level', 'entry' => { 'color' => 'yellow', 'desc' => '/mail/vol/cns +04-fs16 (9 3%) has reached the defined disk space WARNING level (92%) +' }, 'received_by' => '10.10.10.10', 'name' => 'disk', 'state' => { 'name' => 'online', 'data' => {} }, 'received_at' => 'Thu Mar 30 15:03: +16 EST 200 6', 'length' => '6.43 days', 'color' => 'yellow' }, 'grouping' => { 'secondary' => 'Mail Filers', 'primary' => 'Storage Servers' } },


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re^3: XML::Simple element handling by blue_cowdawg
in thread XML::Simple element handling by linwood

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.