perl array of hashes sorting

Posted by srk on Stack Overflow See other posts from Stack Overflow or by srk
Published on 2010-03-24T19:38:01Z Indexed on 2010/03/24 19:43 UTC
Read the original article Hit count: 359

Filed under:
|
|
|
use strict;
my @arr;
$arr[0][0]{5} = 16;
$arr[0][1]{6} = 11;
$arr[0][2]{7} = 25;
$arr[0][3]{8} = 31;
$arr[0][4]{9} = 16;
$arr[0][5]{10} = 17;

sort the array based on hash values so this should change to

$arr[0][0]{6} = 11;
$arr[0][1]{9} = 16;
$arr[0][2]{5} = 16;
$arr[0][3]{10} = 17;
$arr[0][4]{7} = 25;
$arr[0][5]{8} = 31;

first sort on values in the hash.. when the values are same reverse sort based on keys... Please tell me how to do this..

Thank you

© Stack Overflow or respective owner

Related posts about perl

Related posts about array