Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Sorting an AoHoH or AoHoAoH

by broquaint (Abbot)
on Jun 23, 2004 at 03:04 UTC ( [id://368929]=note: print w/replies, xml ) Need Help??


in reply to Sorting an AoHoH or AoHoAoH

A straightforward solution is to sort at a finer granularity e.g
use DDS; # your $events structure here ... @$events = sort { $a->{month} <=> $b->{month} } @$events; @{$_->{list}} = sort { $a->{date} <=> $b->{date} } @{$_->{list}} for @$events; Dump $events; __output__ $ARRAY1 = [ { list => [ { date => 10, name => 'picnic' }, { date => 15, name => 'high tea' }, { date => 23, name => 'rafting' } ], month => 7, name => 'July' }, { list => [ { date => 12, name => 'golfing' }, { date => 20, name => 'retreat' }, { date => 29, name => 'marathon' } ], month => 8, name => 'August' } ];
HTH

_________
broquaint

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-16 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found