How to store contents of a command in array of variables in shell script?

I want to store contents of command
dir in array of variables

For eg: dir contents are
command d2 demovi~ file inven java new untitled folder
d1 demovi er1 filename inven~ myfiles ubuntu desktop xmms

-----------------------------------
I should be able to get command, d2, demovi~,.............. in var1, var2, var3,....
eg. echo $var4
should give output : file

Thanks in advance
Its urgent

If it's that urgent, you should have had a look in one of the thousands of shell scripting guides on the web...

Example in ksh:

# set -A myarray command d2 demovi~ file inven java new untitled folder
# echo ${myarray[3]}
file

I cannot directly set dir command output contents to myarray. Please suggest some other way.

Sure can you do this:

ksh example again:

set -A myarray `ls -1 /yourdir`
...

Edit: Removed your last post here as you started a new thread for it, good choice.