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 |