function return array

Hi all

I would like to know if there is a way to return an array for a function.
As I know function can return all the contents in an array, I want to return an array type.

What scripting language?

bash shell script

A function can only return a return code, which is a cardinal (positive integer or zero).

However a function can modify an array held in the calling script.

$ cat function_return_array
#!/bin/bash

function myarray()
{
        a[1]=moja
        a[3]=three
}

a[1]=one
a[2]=two

myarray

echo ${a[1]}
echo ${a[2]}
echo ${a[3]}
$ ./function_return_array
moja
two
three
$

so the array seems act as a globle variable,right?
if a function is called several times in the script, then I need to store it in another array before calling it again, right?

That's correct.

then I have another issue. how to assign an array value to another one i.e. clone?