jiwei800715 has asked for the wisdom of the Perl Monks concerning the following question:
array's columns are name,date and time; I want sort this HoA first by date*1000000+time and second by key. I remmber that we can usemy %HoA={ 1=>["ab",20090101,91010], 2=>["cd",20090101,91010], 3=>["ef",20090201,101000], ...... }
to sort AoH, but I am not suresort {$a->{'date'} <=> $b->{'date'} || $a->{'dataentry'} <=> $b->{'dat +aentry'}} @AoH;
is that ok? -----yes I tried it, but it can not runsort { ($HoA{$a}[1]*1000000+$HoA{$a}[2]) <=> ($HoA{$b}[1]*1000000+$HoA +{$b}[2]) || $a <=> $b} keys(%HoA)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort HoA by tow keys
by shmem (Chancellor) on Mar 23, 2009 at 12:48 UTC | |
|
Re: sort HoA by tow keys
by moritz (Cardinal) on Mar 23, 2009 at 10:29 UTC | |
|
Re: sort HoA by tow keys
by AnomalousMonk (Archbishop) on Mar 23, 2009 at 21:54 UTC | |
|
Re: sort HoA by tow keys
by Anonymous Monk on Mar 23, 2009 at 13:06 UTC |