View Single Post
Old 03-10-2005, 04:57 AM  
Phil21
Confirmed User
 
Join Date: May 2001
Location: ICQ: 25285313
Posts: 993
You cannot "keep" a hash sorted, it's simply not how hashes work.

Do what you did w/ array storing the keys. Then foreach that array when you want to perform an ordered operation on the hash. Depending on the application of course there are better ways, but considering what posts you've made on the subject this should be fine. Arrays will keep their order of course.

Just do something like..

foreach my $key (@keys) {
my $value=$hash{$key};
print "key $key - value $value\n";
...
}

Shrug..
__________________
Quality affordable hosting.
Phil21 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote