copy

Synopsis

@ copy(@array)

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.

Parameters

@array|$scalar|%hash - the data to copy.

Returns

A shallow copy of the specified data type.

Examples

@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)

See Also