my %hash = ( network_type_1 => { conn_type_1 => [ 1 ], conn_type_2 => [ 2 ] }, network_type_2 => { conn_type_1 => [ 3 ], conn_type_2 => [ 4 ] } ); # To get at the elements: print $hash{ $network }->{ $connection }->[ $pos ];