Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2017-04-29 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.