I am trying to push values into hash. I want to add the values under 'par3'. e.g.
$VAR1 = { 'obj1' => ['par1',
'par2',
'par3' => ['par4','par5','par6',....]]}
I should also be able to add elements into 'par3' in case 'obj1'-'par1'-'par2'-'par3' matches. So far I have this, but I can't figure out how can I add "the second level" under 'par3':
push @{$a{$obj}},$par1,$par2,$par3
[ ... ]is a reference to an array. Array elements are scalars. So it is not possible to directly have the structure you seem to be requesting (ie. thepar3 => [ ... ]pseudocode from your question). See perldscIt's not obvious what you are trying to do but a couple of possible ideas might be to use a reference to a hash, or to replace the array with a hash: