in reply to Re: Arrays in arrays, how to access them
in thread Arrays in arrays, how to access them

Anonymous Monk has proposed a hash of arrays data structure, which enables you to name the sub_arrays. This is fine if you need to names these arrays. If you don't particularly need to name them, then the array of arrays structure that I outline above is just as fine for what you want to do. You could have something like this:

my @array = ([$str_1_1, $str_1-2], [$str_2_1, $str_2_2]);

It is then easy to process the strings of any subarray.

Update 08:35 UTC: added the following examples under the Perl debugger:

DB<1> @array = (["str_1_1", "str_1-2"], ["str_2_1", "str_2_2"]) DB<2> DB<2> x @array 0 ARRAY(0x253a70) 0 'str_1_1' 1 'str_1-2' 1 ARRAY(0x58f8a8) 0 'str_2_1' 1 'str_2_2' DB<3> x $array[1] 0 ARRAY(0x58f8a8) 0 'str_2_1' 1 'str_2_2' DB<4> p "$array[1][$_] \n" for 0..1 str_2_1 str_2_2