Extracts a subset of the specified array from the specified start index up to but not including the specified end index.
@array - the list to grab a subset of.
start - the start index.
end - the optional end index, if not specified will default to the rest of the array.
The specified sublist.
@array = @("a", "b", "c", @("dd", "ee", "ff"), "g", "h"); @sub = sublist(@array, 2, 4); # note that an array scalar counts as 1 element. println(@sub); # modifications to the sublist also affect the parent. @sub[1] = "what happened?"; println(@sub); println(@array);
@('c', @('dd', 'ee', 'ff')) @('c', 'what happened?') @('a', 'b', 'c', 'what happened?', 'g', 'h')