lnong
07-10-2003, 05:18 PM
I want to create an array of arrays of strings. Here's what I tried doing:
my (@arrayOfArrays, @array);
This is inside a FOR Loop
{
@array = (@array, "myString");
@arrayOfArrays = (@arrayOfArrays, \@array);
}
That should create an array of array references, where each reference points to an array of increasing size (i.e. one more element than the previous array).
Now, what if I want to add a string value directly to one of the subarrays, say the 5th array (index=4). How would I do it? Is this how?
$arrayOfArrays->[4] = ($arrayOfArrays->[4], "2ndString");
Probably not, because it's not working. Please help with this. Thanks.
my (@arrayOfArrays, @array);
This is inside a FOR Loop
{
@array = (@array, "myString");
@arrayOfArrays = (@arrayOfArrays, \@array);
}
That should create an array of array references, where each reference points to an array of increasing size (i.e. one more element than the previous array).
Now, what if I want to add a string value directly to one of the subarrays, say the 5th array (index=4). How would I do it? Is this how?
$arrayOfArrays->[4] = ($arrayOfArrays->[4], "2ndString");
Probably not, because it's not working. Please help with this. Thanks.