Dynamic Variable Based on Count

I'm trying to assign variables that include the current value of a count, but I can't seem to get it working... this script is incomplete, but some guidance on how to use a dynamic variable would be helpful:

Sample Input:

bash-2.03$ more sg2.txt
Results for group6
443
1394

Results for group7
15191-15199
15240
15130-15133
15257
15231
15147-15159

Results for group8
15255
15257

Results for group9
104-104 (udp)
104

Results for group10
2380-2381
2370-2371

Like I said, this is incomplete and there may be more efficient ways of doing this, but I need help with the denoted portion:

#!/bin/bash
COUNT=1
ENHANCE=0
while read line
do

case "$line" in

Results*) NAME=`echo "$line" | cut -d " " -f 3` ;;
[0-9]*udp*) PORTa=`echo "$line" | cut -d "-" -f 1`; PORTb=`echo "$line" | cut -d "-" -f 2 | cut -d " " -f 1`
            if [ $PORTa = $PORTb ]; then
            PORT$COUNT="service-object udp $PORTa"
            else
            PORT$COUNT="service-object udp range $PORTa $PORTb"
            fi
            COUNT=`expr $COUNT + 1`
            ENHANCE=1 ;;
ping) PORT$COUNT="echo "service-object icmp""
      COUNT=`expr $COUNT + 1`
      ENHANCE=1 ;;
[0-9]*) case "$line" in
         [0-9]*-[0-9]*) PORTa=`echo "$line" | cut -d "-" -f 1`; PORTb=`echo "$line" | cut -d "-" -f 2 | cut -d " " -f 1` ;
                       PORT$COUNT="service-object tcp range $PORTa $PORTb" ;
                       COUNT=`expr $COUNT + 1` ;;
         [0-9]*) "echo "service-object tcp $line""
                COUNT=`expr $COUNT + 1` ;;
        esac;;
*) if [ $ENHANCE -eq 0 ]; then
     echo "object-group service $NAME tcp"
     PORTCOUNT=1
     while [ $PORTCOUNT -lt $COUNT ]
     do
     echo "$(PORT$PORTCOUNT)"
     PORTCOUNT=`expr $PORTCOUNT + 1`
    done
        else
     PORTCOUNT=1
     while [ $PORTCOUNT -lt $COUNT ]; do
     echo "$PORT$PORTCOUNT"
     PORTCOUNT=`expr $PORTCOUNT + 1`
     done
   fi
esac
done < sg2.txt

try this:

eval PORT$COUNT="service-object udp $PORTa"

Anyways -- it looks like you're tying to get a variable labelled PORT1, or PORT2....

but later you're referencing a variable just called PORTCOUNT...

I see how it is a bit confusing to use PORTCOUNT as a variable when earlier I tried to use PORT$COUNT, but what I was trying to accomplish was to list each PORT$COUNT (PORT1 PORT2 PORT3, etc) all the way up to whatevere $COUNT ended at, which is a dynamic number each time through the loop.

So, until $PORTCOUNT = $COUNT

I'll give the eval a shot.