Returns a shallow copy of the specified array.
$ copy($scalar)Returns a shallow copy of the specified scalar.
% copy(%hash)Returns a shallow copy of the specified hash.
@array|$scalar|%hash - the data to copy.
A shallow copy of the specified data type.
@a = @(1, 2, 3, 4, 5); @b = copy(@a); @a[2] = "moo"; println("@a is now: " . @a); println("@b is now: " . @b);
@a is now: @(1, 2, 'moo', 4, 5) @b is now: @(1, 2, 3, 4, 5)