Tristan <> wrote:
> how to put more arrays in one?
> @array1 = qw(Quarter Dime Nickel Penny);
> @array2 = qw(test1 test2 test3 test4);
> @array3 = (1,2,3,4,5,6,7,8,9,10);
> @array4 = (11,22,33,44,55);
> I want to have only one multidimensional array. How to do it?
There are no true multidimensional arrays in Perl. But what you
can use instead is an arrary of array references, e.g.
my @array = ( [ qw( Quarter Dime Nickel Penny ) ],
[ qw( test1 test2 test3 test4 ) ],
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ],
[ 11, 22, 33, 44, 55 ] );
Now e.g. $array[1][3] (or $array[1]->[3], if you prefer the
slightly longer version) is the string 'test4'.
Regards, Jens
--
\ Jens Thoms Toerring ___
\__________________________
http://toerring.de