Not an ARRAY reference
- From: jtbutlerhvb@xxxxxxxxxxx
- Date: 1 Dec 2005 19:32:54 -0800
I am reading an XML file in perl and looping through the items and
manipulating data. If I have 2 or more 'menuitems' in my xml file it
works ok. if i only have one like the code below I get "Not an ARRAY
reference" at the foreach line - any ideas why?
$create_menu = new XML::Simple (KeyAttr=>[]);
$data = $create_menu->XMLin($xml_file);
foreach $e (@{$data->{menuitem}}){
......
}
xml is
<?xml version='1.0'?>
<menu>
<menuitem>
<node>1</node>
<parent>1</parent>
<sibling>1</sibling>
<submenu>0</submenu>
<subsubmenu>0</subsubmenu>
<label>ramooooooooooon</label>
<link>topic1.xml</link>
</menuitem>
</menu>
.
- Follow-Ups:
- Re: Not an ARRAY reference
- From: John Bokma
- Re: Not an ARRAY reference
- From: it_says_BALLS_on_your_forehead
- Re: Not an ARRAY reference
- Prev by Date: Re: Addition of same value
- Next by Date: Re: Not an ARRAY reference
- Previous by thread: Re: Addition of same value
- Next by thread: Re: Not an ARRAY reference
- Index(es):
Relevant Pages
|