perl -MData::Dumper -le'$t{x}{y}[2]{foo}[3]{bar}=1; print Dumper \%t' $VAR1 = { 'x' => { 'y' => [ undef, undef, { 'foo' => [ undef, undef, undef, { 'bar' => 1 } ] } ] } };