in reply to Add value to array hash

use strict; use Data::Dumper; my $VAR1 = { 'Actions' => [ { 'ID' => '0001', 'Action' => [ { 'Type' => 'Registry', 'Method' => 'CreateKey', 'Key' => 'HKEY_LOCAL_MACHIN +E\\SOFTWARE' }, { 'Type' => 'Registry', 'Method' => 'CreateKey', 'Key' => 'HKEY_LOCAL_MACHIN +E\\SOFTWARE' }, ], 'Description' => 'All possible returns of C +reateKey.', 'Name' => 'CreateKey' } ] }; $VAR1->{'Actions'}[0]{'Action'}[0]{'Value'} = [ { 'Type' => 'REG_DWORD', 'content' => 'Test1', }, { 'Type' => 'REG_DWORD', 'content' => 'Test2', } ]; print Dumper(\$VAR1);
Output:
$VAR1 = \{ 'Actions' => [ { 'ID' => '0001', 'Action' => [ { 'Value' => [ { 'Type' => +'REG_DWORD', 'content' +=> 'Test1' }, { 'Type' => +'REG_DWORD', 'content' +=> 'T+est2' } ], 'Type' => 'Registry', 'Method' => 'CreateKey', 'Key' => 'HKEY_LOCAL_MACH +INE\\SOFTWARE' }, { 'Type' => 'Registry', 'Method' => 'CreateKey', 'Key' => 'HKEY_LOCAL_MACH +INE\\SOFTWARE' } ], 'Name' => 'CreateKey', 'Description' => 'All possible returns of + CreateKey.' } ] };

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James