in reply to insert value into an array
Are you sure you are asking the right question and that the code represents what you think that it does? The following code does what you ask for and dumps the result:
use warnings; use strict; use Data::Dump::Streamer; my @arr=(["one" => [1,11]], ["two"=> [2,22]]); push @{$arr[1][1]}, 222; Dump (\@arr);
Prints:
$ARRAY1 = [ [ 'one', [ 1, 11 ] ], [ 'two', [ 2, 22, 222 ] ] ];
However, I suspect that what you want is not an AoAoA, but a HoA, in which case it all looks like this:
use warnings; use strict; use Data::Dump::Streamer; my %arr= ("one" => [1,11], "two"=> [2,22]); push @{$arr{'two'}}, 222; Dump (\%arr);
Prints:
$HASH1 = { one => [ 1, 11 ], two => [ 2, 22, 222 ] };
|
|---|