Generate array name at run time Korn shell

Hi,

I am trying to define number of array based on constant derived during execution phase of a script. Here is what i am trying..

#First Part, Get LUN input from User
lun_count=4
count=0
set -A my_lun
while :
do
while [[ $lun_count -ne 0 ]]; do
        read L?"Enter Lun "$count" Number:"
        my_lun[count]=${L}
        lun_count=$(( $lun_count-1 ))
        count=$(( $count+1 ))
done

#Second Part, Get Slices input from user for each LUN.
lun_count=4
if [ "$lun_count" -gt 1 ];
then
count=0
while [[ $count -lt ${#my_lun[*]} ]]; do
set -A my_slice_${my_lun[$count]}
echo "Enter Slices number in  LUN: ${my_lun[$count]}:"
export count1=0
while :
do
        read g1?"Enter Slice Number:"
        [ -z "${g1}" ] && break
        my_slice_${my_lun[$count]}[$count1]=${g1}
        count1=$(( $count1+1))
done
count=$(( $count+1 ))
fi

My question is in the second part, where i am dynamically generating the Array name & then assigning element values to it depending on the counter.

For example:

For the first loop, i give two LUN numbers, say 10 & 11. So, my first array would be

my_lun[0]=10
my_lun[1]=11

For the second loop, since in generating the array name based on the LUN name & i give 3 values as elements for each array. So, my array should look like ( this is my question),

my_slice_10[0]=3
my_slice_10[1]=4
my_slice_10[2]=6

my_slice_11[0]=1
my_slice_11[1]=7
my_slice_11[2]=5

But i am getting the following error when i try to execute this..

my_slice_10[0]=3: not found

If i do not generate the array name at run time & define it at the beginning, then it is working fine. Any idea, what i am doing wrong here.

Any info would be of great help.

Thanks,
Harris.

in the loop, try

eval "my_slice_${my_lun[$count]}[$count1]=${g1}"

Worked perfectly fine. Thanks a bunch Frans!!!

-Harris.