reverse

Synopsis

@ reverse(@|&)

Returns a copy of the specified array/iterator in reverse order.

Parameters

@|& - the array or iterator to copy and reverse.

Returns

A copy of the specified array or iterator in reverse order.

Examples

@array = @("a", "b", "c", 1, 2, 3.0); @copy = reverse(@array); println(@copy);

@(3.0, 2, 1, 'c', 'b', 'a')

sub iterator { local('$x'); for ($x = 0; $x < 4; $x++) { yield $x * 45; } } @copy = reverse(&iterator); println(@copy);

@(135, 90, 45, 0)

See Also