Passing an array to a function
When an array is passed as an argument to a function, it is passed by reference. This means that the function works
with the actual array, not with a copy. Anything that the function
does to the array has an effect on the original array. split is
a built-in function that takes an array as an argument.
- split(string,array)
- split breaks up string into fields, and assigns
each of the fields to an element of array. The first field
is assigned to array[1], the next to array[2], and so on. Fields are assumed to be separated with the
field separator string FS. If you want to use a different
field separator string, you can use:
where fsstring is the field separator string you want to use instead of FS. The result of split is the number of fields that string contained.split(string,array,fsstring)
Note: split actually changes the elements
of array. When an array is passed to a function, the function
may change the array elements.