I can loop through each roomtype but if a roomtype has more that one mealtype I get this error: The ForceArray option is enabled. Please Help!

gives me this error message / faulty output:

Not a HASH reference

This is the dump from the XML that is begin returned to me:

$VAR1 = { 'success' => 'true', 'data' => { 'bb' => { 'roomtypes' => { 'roomtype' => [ { 'rtimage' = +> '10002-2.jpg', 'ratescheme +' => '1', 'rtid' => ' +2', 'roomsfree' + => '2', 'childpolic +y' => { + 'general' => '2 - 12 years stay', + 'allowchild2' => 'Y', + 'allowchild1' => 'Y' + }, 'mealtypes' + => { + 'mealtype' => [ + { + 'defaultmealtype' => 'true', + 'rates' => { + 'pax3' => '1180.00', + 'pax2' => '930.00', + 'pax4' => '1405.00', + 'pax1' => '550.00' + }, + 'mealtypedesc' => 'Bed & Breakfast', + 'rateid' => '6' + }, + { + 'rates' => { + 'pax3' => '850.00', + 'pax2' => '700.00', + 'pax4' => '975.00', + 'pax1' => '450.00' + }, + 'mealtypedesc' => 'Self-catering', + 'rateid' => '7' + } + ] + }, 'maxoccupan +cy' => '6', 'minlos' => + '0', }, { 'ratescheme +' => '1', 'rtid' => ' +1', 'roomsfree' + => '5', 'descriptio +n' => 'Double bed', 'childpolic +y' => { + 'general' => '2 - 12 years stay', + 'allowchild2' => 'Y', + 'allowchild1' => 'Y' + }, 'mealtypes' + => { + 'mealtype' => { + 'defaultmealtype' => 'true', + 'rates' => { + 'pax2' => '800.00', + 'pax1' => '500.00' + }, + 'mealtypedesc' => 'B&B', + 'rateid' => '5' + } + }, 'maxoccupan +cy' => '2', 'minlos' => + '0', } ] }, }, 'nights' => '1', 'enddate' => '2011-01-24', 'startdate' => '2011-01-23' } };

In reply to xml simple not a hash reference by Noverast

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.