in reply to Perl DSC and or XML::Simple

Try:

foreach my $href ( @{$refdata->{'Map'}} ){ print $href->{'MapId'} ."\n"; }

$refdata->{Map} is an arrayref, to get the array contents you need to stick an '@' on the front and add braces to specify what the '@' applies to. Without the braces it would try to treat $refdata as an arrayref - which it is not.

I'm parsing an XML Document into a perl data structure using XML::Simple with the default (Read: No) options

I can't recommend that :-) You should at least use:

my $refdata = XMLin('C:/myxmltest.xml', forcearray => [ 'Map' ]);

That way your code won't break if there's only one 'Map' element.

Replies are listed 'Best First'.
Re: Re: Perl DSC and or XML::Simple
by dataDrone (Acolyte) on Sep 05, 2002 at 00:06 UTC
    Thanks for the 'heads up' Grant, I wouldn't have noticed for at least a few days. Always nice to get help from the module's Author, that's what i like about the Perl community.