Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How do I reverse an array of arrays?

by Anonymous Monk
on Sep 23, 2000 at 21:51 UTC ( [id://33782]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: (data structures)

How do I reverse an array of arrays?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I reverse an array of arrays?
by merlyn (Sage) on Sep 23, 2000 at 21:54 UTC
    First, there's no array of arrays. The closest Perl has is an array of arrayrefs.

    Second, "reverse" along what axis? The top level is simple:

    @reversed = reverse @array;

    The second level is also pretty easy:

    @second_level_reversed = map [reverse @$_], @array;
    And you can add a reverse ahead of map to do them both.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://33782]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-03-28 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found