in reply to Not able to fetch value in a multi-dimentional HASH

With the dump you provided, I'm getting
Data=value1
Are you running the same code as posted?
Is not your output buffered? You might need to append \n to the end of the printed string.

Replies are listed 'Best First'.
Re^2: Not able to fetch value in a multi-dimentional HASH
by bose1981 (Initiate) on Feb 05, 2012 at 21:13 UTC

    Hi Choroba - thanks for the reply. yes i am running the same code and used /n. but no data. Also when i do not use keyAttr and other parameters i am getting a different dump(which i understand) and am able to fetch the values. why i dont want this simple dump is because the value1 , value 2 and value 3 are ID values which keeps changing and i have to collect them dynamically. can we collection them, in that case i will have a simpler hash to travel

    Below is the dump when i do not use keyAttr and Force attributes in de +claring the xml variable $VAR1 = { 'response1' => { 'value1' => { 'tag1'=>'value2' 'tag2'=>'value3' 'tag3'=>'value4' }, 'value2' => { 'tag1' => 'value4', 'tag2' => 'value5', 'tag3' => 'value6', } 'value3'=> { 'tag1'=> 'value9' 'tag2'=> 'value10' } };
      /n is not \n. You do not mention value1 as a key in your previous dump, so I am confused. Maybe you can post a part of the XML?
        i was able to make it work. I was wrong in referencing. when i was using keyAttr=>Response3, its creating an array inside response3 which i can access as {'response3'}->[0]->{'tag1'}. This gave me the right values.