in reply to sorting in hashes

please put your code between <code> </code> tags, like this
my %hash=(inst => { dept1 => { rollno=> { [name,marks], [name1,marks1] +, }, inst2.... });


do you want to sort by inst, dept, marks?
I think we need a little more description of your structure, rollno is that a constant, or is it a value like isnt or dept1? why are the marks in array refs inside a hashref, which wouldn't work if you had an odd number of names. You would want them either in an arrayref like rollno => [ [name, marks], ... ] or in a hashref like rollno => { name => marks, name => marks, ... }.

And as mentioned in another response, supply what your data would look like sorted.

Replies are listed 'Best First'.
Re^2: sorting in hashes
by Util (Priest) on Aug 22, 2009 at 13:39 UTC
      Also, please
    1. expand your sample data to include multiple institutes with multiple departments (instead of just ....), and
    2. provide an example of the output or data structure you are trying to achieve with the sort, that matches the expanded sample data.