in reply to Order a hash?

Yes, hashes have no concept of order. Arrays do. The larger issue of your problem leads me to believe that hashes are the better data structure.

You choice then is to sort the keys of the hash. You foreach loop ( which I write as a for loop - they are identical, so do not be confused ) would look something like:

for my $key ( sort keys %title ) {
which will sort the keys in asciibetical order. To sort the keys on some criteria other than asciibetical, try something like this ( I hope I remember how fetch_all_hash works ):
# This will sort by title, then by topic id sub by_course_and_title { return $title{$a}{il2e002_course_title_x} cmp title{$b}{il2e002_cour +se_title_x} || $title{$a}{il2e002_topic_id_k} cmp title{$b}{il2e002_topic_id +_k}; } for my $key ( sort &by_course_and_title keys %title ) {

In answer to your other question, how to step through an array, it is simply

for my $foo ( @foo ) { # Do something interesting }
See perldoc -f sort to understand a bit more of the possibilities of the sort command - it is quite potent.

mikfire