in reply to sort a hash array

Instead of using 'C-style' for loops:
my $index=0; for ($index=0;$index<=$x;$index++) { }
Compel to the power of Perl:
for my $index(0..$x) { }
Also, i have found that i if i need to sort a hash, then i probably should have been using an array instead. There is a reason why one shouldn't care about the order of hash keys. BUT, when you do care, sort is your friend.

And personally, i find wog's code easier to understand than yours. Just give it some time and you will too. ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)