ThatThat's the error would be outputted byyou'd get if you were interpreting that script with the Bourne shell, a very old shell from the 70s hardly used any more these days except maybe on Solaris 10 and older.
So my bet would be that that script is being interpreted by /bin/sh on Solaris 10 or older, not ksh. On Solaris, the standard sh is in /usr/xpg4/bin/sh.
The Bourne shell did not support the $(...) form of command substitution, you had to use `...` instead.
In any case, neither the Bourne shell nor the POSIX sh specification support arrays. To assign an array variable the content of the non-empty lines of the output of a command with Solaris 10's /bin/ksh (which is based on ksh88), you'd need:
set -o noglob
IFS='
'
set -A array -- $(cmd)
(note that ksh88 arrays can't have more than 4096 elements).
And then you display the elements of the array as:
((${#array[@]})) && printf '"%s"\n' "${array[@]}"
If your script has a #!/bin/ksh she-bang, it should be invoked as /path/to/the/script or ksh /path/to/the/script, not sh /path/to/the/script.