mexnix has asked for the wisdom of the Perl Monks concerning the following question:
$VAR1 = { 'news' => [ { 'title' => 'news1', 'content' => 'Article Contents...blah', 'date' => '08-03-01' }, { 'title' => 'news2', 'content' => 'Article Contents...blah', 'date' => '07-20-01' } ] };
I need to sort @$news by $data->{news}[$ele]{date} where $ele is the index in the array. I tried sort {$data->{news}[$a]{date} <=> $data->{news}[$b]{date}} @{$data->{news}};, but that didn't work. any ideas. Maybe need to change how the date is stored? I'm open to anything. thanks.
__________________________________________________
<moviequote name="Hackers">
The Plague: [...]Well let me explain the New World Order. Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo!
</moviequote>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting complex data
by dga (Hermit) on Aug 08, 2001 at 23:30 UTC | |
|
Re: sorting complex data
by VSarkiss (Monsignor) on Aug 08, 2001 at 23:38 UTC |