On Mon, 18 Jun 2001, Yacketta, Ronald wrote:
> Is it possible to store an array name inside another array?
>
> IE:
> @array1 = bunch o' file names
>
> @array2 = { bah, @array1, blah, blah }
>
> actualy that would be a pointer from @array1 -> @array2 correct?
You can do that, but you need to use references (and you have to use
parentheses):
@array1 = bunch o' file names
@array2 = ( bah, \@array1, blah, blah );
Or you can create an anonymous array (using square brackets):
$array_ref = ['file1', 'file2', 'file3'];
@array2 = ( bah, $array_ref, blah, blah );
Or you can even put the reference directly into the array:
@array2 = ( bah, ['file1', 'file2', file3'], blah, blah );
You can do this with arrays and hashes, and create arrays of arrays,
arrays of hashes, hashes of arrays, hashes or hashes, hashes of hashes of
arrays, and so on. You are limited only by your imagination and your
willingnees to code and comprehend complex data structures. :-)
-- Brett
http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
The brain is a wonderful organ; it starts working the moment you get up
in the morning, and does not stop until you get to work.