http://www.perlmonks.org?node_id=535877


in reply to How do I reverse array elements?

Of course, most of the time, reverse is adequate and correct; but the following gives you more control when you need it.

sub rev { my @r; push @r, pop @_ while @_; @r }