The knowledge gained from both tye and btrott's
wisdom will surely benefit me in the future, but mirod's
offering seems like the right thing to do in this case. I
was so focused on the lists it didn't occur to me to go
back to XML::Simple's documentation for a way to alter
the list. Adding forcearray to XMLin() eliminates the
problem.
my$data = XMLin($url, forcearray => 1);
Results in the following for a single entry (note the [ and
], they're not present without forcearray):
$data = {
'foo' => [{
'one' => '1',
'two' => '2'
}]
};
Thank you all!
Update: I've found that sometimes
you also must specify which hash to force by specifying the
keyattr.
my$data = XMLin($url, keyattr => 'foo', forcearray => 1);
|