Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Sorting an AoHoH or AoHoAoH

by Ido (Hermit)
on Jun 23, 2004 at 03:13 UTC ( [id://368931]=note: print w/replies, xml ) Need Help??


in reply to Sorting an AoHoH or AoHoAoH

Your second sort phase should sort different lists. In order to do that you should sort more than once. Also, please notice that every element of @s1_events is a hashref, and the 'list' element of the hashref is an arrayref, not another hash. Therefore, you can't $a->{list}{date}.
In order to sort each month's list, I would iterate through months, and sort, like:
for(@s1_events){ @{$_->{list}}=sort {$a->{date}<=>$b->{date}} @{$_->{list}}; }
Hth..

Replies are listed 'Best First'.
Re^2: Sorting an AoHoH or AoHoAoH
by bradcathey (Prior) on Jun 23, 2004 at 03:18 UTC
    Thanks broquaint and Ido for the nearly instant solution and explanation, helping me get my head around these complicated data structures. I Googled for hours, but found it here at the monastery in minutes. Thanks.

    —Brad
    "Don't ever take a fence down until you know the reason it was put up. " G. K. Chesterton

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-23 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found