in reply to Re: How to sort Hashes of Hashes and print results in a file
in thread How to sort Hashes of Hashes and print results in a file

Ok let me rephrase. Here is my hash
%hash{ a => {doc1=>'2.0', doc2=>'4.5', doc7=>'3.0' }, b => { doc2 => '3.5', doc10 => '6.5', doc7 => '11.4', doc20 => '0.5' } }

Now for 'a' I need to retrieve top 2 doc with highest value.
In this case it will be 'doc2' and 'doc7'
In case of 'b' it will be 'doc7' and 'doc10'
Number of docs will differ in 'a' and 'b'.
Does this clarify my question

Replies are listed 'Best First'.
Re^3: How to sort Hashes of Hashes and print results in a file
by gulden (Monk) on Mar 27, 2009 at 23:55 UTC
    I've run my script and the result was:
    -> a
    --> doc2: 4.5
    --> doc7: 3.0
    
    -> b
    --> doc7: 11.4
    --> doc10: 6.5