Hey guys... here is the situation:
@list1 = ("one", "two", "three");
@list2 = ("myList2");
@fooList = ([@list2], [@list1]);
Basically what I want to do is walk down each array in
@fooList. For instance I want to read data from @list2,
element at a time, then @list1, but I want to be able to
add new arrays to @fooList at any time. So I don't know
the size of @fooList or any of the arrays ahead of time.
(essentially I want to make more arrays to add to @fooList and not have to change any of my code later on in the script. So I would just make a new Array and add that Array to the Array of Arrays -@fooList)
So I want it to work like this (though it doesn't )
foreach $thing1 (@fooList)
{
foreach $currentThing ($fooList[$thing1]);
{
print "$currentThing\n";
}
}
So what I would like to happen in this case is have it print out each
element in each list.
so output would be like:
mylist2
one
two
three
I could use "for" loops I guess but I would need to know the sizes of the arrays inside @foolist on the fly, and I couldn't figure out how to do that either..
Or I might just be crazy..
Thanks much for the help!
@list1 = ("one", "two", "three");
@list2 = ("myList2");
@fooList = ([@list2], [@list1]);
Basically what I want to do is walk down each array in
@fooList. For instance I want to read data from @list2,
element at a time, then @list1, but I want to be able to
add new arrays to @fooList at any time. So I don't know
the size of @fooList or any of the arrays ahead of time.
(essentially I want to make more arrays to add to @fooList and not have to change any of my code later on in the script. So I would just make a new Array and add that Array to the Array of Arrays -@fooList)
So I want it to work like this (though it doesn't )
foreach $thing1 (@fooList)
{
foreach $currentThing ($fooList[$thing1]);
{
print "$currentThing\n";
}
}
So what I would like to happen in this case is have it print out each
element in each list.
so output would be like:
mylist2
one
two
three
I could use "for" loops I guess but I would need to know the sizes of the arrays inside @foolist on the fly, and I couldn't figure out how to do that either..
Or I might just be crazy..
Thanks much for the help!