@aoh =(
{
3 => 15,
4 => 8,
5 => 9,
},
{
3 => 11,
4 => 25,
5 => 6,
},
{
3 => 5,
4 => 18,
5 => 5,
},
{
0 => 16,
1 => 11,
2 => 7,
},
{
0 => 21,
1 => 13,
2 => 31,
},
{
0 => 11,
1 => 14,
2 => 31,
},
);
我想在每個數組索引散列基於值相反的順序進行排序..如何在Perl中維護排序後的散列?
@sorted =排序{...........請填寫此..... .....} @aoh;提前
預期輸出
@aoh =(
{
4 => 8,
5 => 9,
3 => 15,
},
{
5 => 6,
3 => 11,
4 => 25,
},
{
5 => 5,
3 => 5,
4 => 18,
},
{
2 => 7,
1 => 11,
0 => 16,
},
{
1 => 13,
0 => 21,
2 => 31,
},
{
0 => 11,
1 => 14,
2 => 31,
},
);
請幫助..謝謝.. 再次陳述了我的請求:我只希望在每個數組索引哈希值由值進行排序..我不想要的數組進行排序..
這功課嗎? – Ether 2010-03-25 14:52:32