in reply to Managing data after XML::Simple...count elements

my $perl = XMLin($xml);

Calling XMLin() without specifying any options is often a bug waiting to happen, see this node.

Also, when looking for meaningful variable names, it might help to bear in mind that XMLin will throw away the top-level XML element name by default - why not use that:

my $NewDataSet = XMLin($xml, KeyAttr => [], ForceArray => ['Table']) +;

Then when you index into the data, the Perl symbols and the XML element names correspond naturally:

my $table = $NewDataSet->{Table}; my $table_count = @$table;

Replies are listed 'Best First'.
Re^2: Managing data after XML::Simple...count elements
by inblosam (Monk) on Jul 06, 2004 at 21:59 UTC
    Fantastic. Funny enough I just ran into the problem that when there was only one result returned, it would give me an error because there was no array. Now with these options it works all around. WOW! THANKS!