in reply to Printing a Tree of Hash of hashes sorted by value

It'll take me too much time to figure out what your code does. But if you want to sort the hashes, I think you want:
my %hoh = (Method1 => { ... }, Method2 => { ... }, ...); foreach my $key (sort {$hoh{$a}{Category} cmp $hoh{$b}{Category} or $hoh{$a}{File} cmp $hoh{$b}{File} or $hoh{$a}{Name} cmp $hoh{$b}{Name}} keys %hoh) { print Dump $hoh{$key} }

Replies are listed 'Best First'.
Re^2: Printing a Tree of Hash of hashes sorted by value
by Bugz (Acolyte) on Oct 13, 2008 at 20:29 UTC
    Hey Java Fan,
    My apologies for the complicated code. As much as i'd like to simplify it, I have not been able to get the functionality i want.
    As mentioned earlier, my goal is to just sort the hash for print purposes. I do not care what order it is otherwise. The data i have is a collection of methods of different categories stored in different files.
    I wish to print them in ascending order of Category then ascending order of files that belong to that category followed by ascending order of Name of methods in each of those files. ie.
    Functions Alpha.dat ... MNO ... ... .... Methods Beta.dat ABC ... ... ...
    As explained earlier, I can do it, but it takes too much time to do so and I wanted to know if i can speed it up.
    I hope this explains what I wish to achieve.
    Bugz
      In which way doesn't my code do what you want?