http://www.perlmonks.org?node_id=987187


in reply to Strange XML error

I don't know anything about this particular module, but the error says very clearly that $answers->{answer} is not an arrayref. This could be because the parser only returns an array of elements when there is more than one element (which would make sense in some cases). Sometimes functions can be forced into returning arrays by using them in list context. Try using Data::Dumper to see exactly what $answers->{answer} is. Read the docs for XML::Simple, they will probably tell you (unless they really suck) what kind of data structure XMLin returns.


$,=qq.\n.;print q.\/\/____\/.,q./\ \ / / \\.,q.    /_/__.,q..
Happy, sober, smart: pick two.