If I'm understanding you correctly, adding sort when retrieving the keys of the inner hash like you do in the outer hash should do what you desire:
sub printIndex { for my $book ( sort keys %ibIndex ) { # notice the use of sort in the next line for my $keyword ( sort keys( %{ $ibIndex{ $book } } ) { my $pages = join( ', ', @{ $ibIndex{ $book }->{ $keyword } + } ); } } }
In reply to Re: How do I sort a hash in a hash?
by stevieb
in thread How do I sort a hash in a hash?
by dbmathis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |