creating variable array name

#!/bin/ksh

#export CLASSPATH=$CLASSPATH:~dialp/cso/classes:/opt/oracle/product/8.1.6/jdbc/lib/classes12.zip
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/product/8.1.6/lib
DATE="`date '+%m%d%Y'`"
PATH=.:$PATH
export PATH
town_name[0]='123'
town_name[1]='123'
town_name[2]='345'
town_name[3]='123'
town_name[4]='345'
town_name[5]='456'

m=0
n=0
x=0
count=0
y=0

while [ $m -lt ${#town_name
[*]} ]
do
echo "inside ist while"
if [[ ${town_name[$m]} != '' ]] then

town_array_same_$y[$x]=${town_name[$m]}

j=$((m+1))
x=$((x+1))
count=$((count+1))

while [ $j -lt ${#town_name
[*]} ]
do
echo "inside 2nd while"
if [[ ${town_name[$m]} == ${town_name[$j]} ]] then
town_array_same_$y[$x]=${town_name[$j]}
town_name[$j]=''
fi
j=$((j+1))
done
fi

m=$((m+1))

done

"
here i m trying to store the identical values in a separate array. for this in have created a logic that tha name of the array will vary when a second array needs to be created for other identical elements. but the array name is causing problem. could any1 help. The line which is causing problem has been highlighted. The araay is being created bt the values are not getting stored":confused:

eval "town_array_same_$y[$x]=\${town_name[$m]}"