in reply to Assignment of Arrays of Hashes
I got the outputtest1 test2 test3 test4 test44 afsd wfsdf sdfsd
after the first assignment, so the hash is indeed being set up correctly. After the loop, my RefHash was set to$VAR1 = 'field1'; $VAR2 = 'test1'; $VAR3 = 'field2'; $VAR4 = 'test2'; $VAR5 = 'field3'; $VAR6 = 'test3'; $VAR7 = 'field4'; $VAR8 = 'test4';
so it appears that the push worked. Perhaps your problem is to do with the way that you are trying to access the array elements? I was able to access it with$VAR1 = { 'field1' => 'test1', 'field2' => 'test2', 'field3' => 'test3', 'field4' => 'test4' }; $VAR2 = { 'field1' => 'test44', 'field2' => 'afsd', 'field3' => 'wfsdf', 'field4' => 'sdfsd' };
print $RefHash[0]{'field2'},"\n";
|
|---|