in reply to 2D array in Perl

You do not need to initialize your structure at all due to Perl's autovivification: all intermediates are created automatically. The syntax below should work in both versions of Perl you are using.

use strict; use warnings; my %exonHash; my $exonNumber = 1; my $med = 3; push @{ $exonHash{ $exonNumber }->[ 2 ] }, $med;