Array not initializing

Hi,
I have to use array in shell script to perform a logic. When I use below statements inside a script and execute, it gives me an error:

$ cat test.sh
set -A arr 10 20 30
echo ${arr[0]}
$ sh test.sh
a: -A: bad option(s)

But at the same time I can run above two statements without error outside the script on shell. I have tried a lot but don't get it. Can someone pls help me?

Thanks

$ cat foo.sh
#!/bin/ksh
set -A arr 10 20 30
echo ${arr[0]}
$ foo.sh
10

it is still giving error on Sun OS though same is woring on IBM AIX.

works fine on Sun as quoted:

$ uname -a
SunOS bbpser170 5.9 Generic_112233-11 sun4u sparc SUNW,UltraAX-i2