Sometimes it's easier to write a quick script in bash that uses arrays rather than figure out how to do it with something more appropriate like awk or perl.
It's really very quick and simple. To start, declare your variable as an array
[uphill@host]: declare -a myvar
If the array is going to be global then add x to export it.