Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Answer: How do I reverse array elements?

by superfrink (Curate)
on Mar 11, 2006 at 05:17 UTC ( #535877=categorized answer: print w/replies, xml ) Need Help??

Q&A > arrays > How do I reverse array elements? - Answer contributed by superfrink

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 }

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2016-10-25 22:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.