mlseim
11-25-2003, 08:07 PM
For the life of me, I just can't figure this out ...
Take this example:
$start = 1;
$end = 10;
for $list ($start..$end) {
$item="thing$list";
@$item=("zero","one","two","three");
}
I end up with 10 arrays ...
@thing1=("zero","one","two","three");
@thing2=("zero","one","two","three");
@thing3=("zero","one","two","three");
... etc ...
Now I want to print out one of the items in one array ...
$test=3;
print "Here's an item --- $thing$test[2] .... ";
See, I want to print out the item in array "thing3[2]"
I can't figure out how to represent "thing3[2]" in the
print statement, because the "3" is a variable ($test)
I want the print statement to look like this in the end:
Here's an item --- two ....
If I do this,
print "Here's an item --- $thing3[2] ... ";
It works OK.
I just can't make the "3" a variable.
Take this example:
$start = 1;
$end = 10;
for $list ($start..$end) {
$item="thing$list";
@$item=("zero","one","two","three");
}
I end up with 10 arrays ...
@thing1=("zero","one","two","three");
@thing2=("zero","one","two","three");
@thing3=("zero","one","two","three");
... etc ...
Now I want to print out one of the items in one array ...
$test=3;
print "Here's an item --- $thing$test[2] .... ";
See, I want to print out the item in array "thing3[2]"
I can't figure out how to represent "thing3[2]" in the
print statement, because the "3" is a variable ($test)
I want the print statement to look like this in the end:
Here's an item --- two ....
If I do this,
print "Here's an item --- $thing3[2] ... ";
It works OK.
I just can't make the "3" a variable.